mirror of
https://github.com/jlengrand/sample-node-api.git
synced 2026-03-10 08:41:23 +00:00
236 lines
5.5 KiB
JSON
236 lines
5.5 KiB
JSON
{
|
|
"swagger":"2.0"
|
|
,"info":{"description":"Sample Node API"
|
|
,"version":"1.0"
|
|
,"title":"Sample Node API"}
|
|
,"host":"localhost:8080"
|
|
,"basePath":"/"
|
|
,"tags":[{"name":"Accounts","description":"Accounts API"},{"name":"Cars","description":"Cars API"}]
|
|
,"schemes":["http"]
|
|
,"produces": ["application/json"],
|
|
"paths": {
|
|
"/accounts": {
|
|
"get": {
|
|
"x-swagger-router-controller": "accounts",
|
|
"operationId": "getAllAccounts",
|
|
"tags": ["Accounts"],
|
|
"summary": "Get all accounts",
|
|
"parameters": [],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Get all accounts",
|
|
"schema": {
|
|
"$ref": "#/definitions/ArrayOfAccounts"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/accounts/{accountId}": {
|
|
"get": {
|
|
"x-swagger-router-controller": "accounts",
|
|
"operationId": "getAccountDetail",
|
|
"tags": ["Accounts"],
|
|
"summary": "Get account by id",
|
|
"parameters": [ {
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"type": "number",
|
|
"required": true
|
|
}],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Get account by id",
|
|
"schema": {
|
|
"$ref": "#/definitions/Account"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/accounts/{accountId}/cars": {
|
|
"get": {
|
|
"x-swagger-router-controller": "accounts",
|
|
"operationId": "getCarsByAccount",
|
|
"tags": ["Accounts"],
|
|
"summary": "Get all cars for a given account",
|
|
"parameters": [ {
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"type": "number",
|
|
"required": true
|
|
}],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Get all cars for a given account",
|
|
"schema": {
|
|
"$ref": "#/definitions/ArrayOfCars"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/accounts/{accountId}/cars/{carId}": {
|
|
"get": {
|
|
"x-swagger-router-controller": "accounts",
|
|
"operationId": "getCarDetailByAccount",
|
|
"tags": ["Accounts"],
|
|
"summary": "Get car of a given account",
|
|
"parameters": [ {
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"type": "number",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "carId",
|
|
"in": "path",
|
|
"type": "number",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Get car of a given account",
|
|
"schema": {
|
|
"$ref": "#/definitions/Car"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/cars": {
|
|
"get": {
|
|
"x-swagger-router-controller": "cars",
|
|
"operationId": "getAllCars",
|
|
"tags": ["Cars"],
|
|
"summary": "Get all cars",
|
|
"parameters": [],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Get all cars",
|
|
"schema": {
|
|
"$ref": "#/definitions/ArrayOfAccounts"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/cars/{carId}": {
|
|
"get": {
|
|
"x-swagger-router-controller": "cars",
|
|
"operationId": "getCarDetail",
|
|
"tags": ["Cars"],
|
|
"summary": "Get car by id",
|
|
"parameters": [{
|
|
"name": "carId",
|
|
"in": "path",
|
|
"type": "number",
|
|
"required": true
|
|
}],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Get car by id",
|
|
"schema": {
|
|
"$ref": "#/definitions/Car"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions":{
|
|
"Car": {
|
|
"properties": {
|
|
"_id": {
|
|
"type": "number",
|
|
"example": "0"
|
|
},
|
|
"Name": {
|
|
"type": "string",
|
|
"example": "chevrolet chevelle malibu"
|
|
},
|
|
"Miles_per_Gallon": {
|
|
"type": "number",
|
|
"example": "18"
|
|
},
|
|
"Cylinders": {
|
|
"type": "number",
|
|
"example": "8"
|
|
},
|
|
"Displacement": {
|
|
"type": "number",
|
|
"example": "307"
|
|
},
|
|
"Horsepower": {
|
|
"type": "number",
|
|
"example": "130"
|
|
},
|
|
"Weight_in_lbs": {
|
|
"type": "number",
|
|
"example": "3504"
|
|
},
|
|
"Acceleration": {
|
|
"type": "number",
|
|
"example": "12"
|
|
},
|
|
"Year": {
|
|
"type": "string",
|
|
"format": "date",
|
|
"example": "1970-01-01"
|
|
},
|
|
"Origin": {
|
|
"type": "string",
|
|
"example": "USA"
|
|
}
|
|
}
|
|
},
|
|
"Name": {
|
|
"properties": {
|
|
"first": {
|
|
"type": "string",
|
|
"example": "Deidre"
|
|
},
|
|
"last": {
|
|
"type": "string",
|
|
"example": "Hayes"
|
|
}
|
|
}
|
|
},
|
|
"Account": {
|
|
"properties": {
|
|
"_id": {
|
|
"type": "string",
|
|
"example": 0
|
|
},
|
|
"name": {
|
|
"$ref": "#/definitions/Name"
|
|
},
|
|
"email": {
|
|
"type": "string",
|
|
"example":"deidre.hayes@undefined.me"
|
|
},
|
|
"phone": {
|
|
"type": "string",
|
|
"example":"+1 (839) 577-3100"
|
|
},
|
|
"address": {
|
|
"type": "string",
|
|
"example": "507 Church Avenue, Heil, Wyoming, 1754"
|
|
}
|
|
}
|
|
},
|
|
"ArrayOfAccounts": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Account"
|
|
}
|
|
},
|
|
"ArrayOfCars": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Car"
|
|
}
|
|
}
|
|
}
|
|
} |