You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
3.2 KiB
143 lines
3.2 KiB
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "Mockup",
|
|
"description": "A simple API Mock",
|
|
"contact": {
|
|
"name": "Nicolas Massé",
|
|
"url": "https://github.com/nmasse-itix/API-Mockup",
|
|
"email": "nicolas.masse@itix.fr"
|
|
},
|
|
"license": {
|
|
"name": "MIT License",
|
|
"url": "https://opensource.org/licenses/MIT"
|
|
},
|
|
"version": "1.0.0"
|
|
},
|
|
"paths": {
|
|
"/things/": {
|
|
"get": {
|
|
"summary": "Get all things",
|
|
"description": "Get all the things.",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/PersistedThing"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Create a thing",
|
|
"description": "Create a thing by providing the JSON payload.",
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"schema": {
|
|
"$ref": "#/definitions/Thing"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/PersistedThing"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/things/{id}": {
|
|
"get": {
|
|
"summary": "Get a thing by id",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/PersistedThing"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"summary": "Update a thing",
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"schema": {
|
|
"$ref": "#/definitions/PersistedThing"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/PersistedThing"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"summary": "Delete a thing",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/PersistedThing"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "The thing id",
|
|
"required": true,
|
|
"type": "integer"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"definitions": {
|
|
"Thing": {
|
|
"title": "Root Type for Thing",
|
|
"description": "The root of the Thing type's schema.",
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"price": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"PersistedThing": {
|
|
"title": "Root Type for Thing",
|
|
"description": "The root of the Thing type's schema.",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"format": "int32",
|
|
"description": "The thing id",
|
|
"type": "integer"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"price": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|