Skip to content

Instantly share code, notes, and snippets.

@isholaomotayo
Last active September 22, 2019 08:07
Show Gist options
  • Save isholaomotayo/10d93c43edd946ae38da9114417bf230 to your computer and use it in GitHub Desktop.
Save isholaomotayo/10d93c43edd946ae38da9114417bf230 to your computer and use it in GitHub Desktop.
// 20190922090229
// http://localhost:3000/documentation/json
{
"swagger": "2.0",
"info": {
"title": "Fastify API",
"description": "Building a blazing fast REST API with Node.js, MongoDB, Fastify and Swagger",
"version": "1.0.0"
},
"host": "localhost:3000",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"externalDocs": {
"url": "https://swagger.io",
"description": "Find more info here"
},
"paths": {
"/signup": {
"post": {
"responses": {
"200": {
"description": "Default Response"
}
}
}
},
"/api/cars": {
"get": {
"summary": "Get all cars in the database",
"description": "Get all cars in the database",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
}
}
],
"responses": {
"200": {
"schema": {
"description": "Array containing all cars",
"type": "array",
"items": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"name": {
"type": "string"
},
"brand": {
"type": "string"
},
"price": {
"type": "string"
},
"age": {
"type": "number"
},
"services": {
"type": "object",
"properties": {
"serviceDate": {
"type": "string",
"format": "date"
}
}
}
}
}
},
"description": "Array containing all cars"
}
}
},
"post": {
"summary": "Add a car from the database",
"description": "Add a cars from the database",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"type": "object",
"required": [
"name",
"brand",
"age"
],
"properties": {
"_id": {
"type": "string"
},
"name": {
"type": "string"
},
"brand": {
"type": "string"
},
"price": {
"type": "string"
},
"age": {
"type": "number"
},
"services": {
"type": "object",
"properties": {
"serviceDate": {
"type": "string",
"format": "date"
}
}
}
}
}
}
],
"responses": {
"200": {
"schema": {
"description": "A car",
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"name": {
"type": "string"
},
"brand": {
"type": "string"
},
"price": {
"type": "string"
},
"age": {
"type": "number"
},
"services": {
"type": "object",
"properties": {
"serviceDate": {
"type": "string",
"format": "date"
}
}
}
}
},
"description": "A car"
}
}
}
},
"/api/cars/{id}": {
"get": {
"summary": "Get a car from the database",
"description": "Get a cars from the database",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
}
},
{
"type": "string",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"schema": {
"description": "A car",
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"name": {
"type": "string"
},
"brand": {
"type": "string"
},
"price": {
"type": "string"
},
"age": {
"type": "number"
},
"services": {
"type": "object",
"properties": {
"serviceDate": {
"type": "string",
"format": "date"
}
}
}
}
},
"description": "A car"
}
}
},
"put": {
"responses": {
"200": {
"description": "Default Response"
}
}
},
"delete": {
"responses": {
"200": {
"description": "Default Response"
}
}
}
}
}
}
https://granite-daphne.glitch.me/OAS.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment