{
"openapi": "3.0.0",
"info": {
"license": {
"name": "MIT"
},
"title": "Swagger Petstore",
"version": "1.0.0"
},
"servers": [
{ "url": "http://petstore.swagger.io/v1" }
],
"paths": {
"/pets/{petId}": {
"get": {
"operationId": "showPetById",
"tags": [ "pets" ],
"summary": "Info for a specific pet",
"parameters": [
{
"description": "The id of the pet to retrieve",
"in": "path",
"name": "petId",
"required": true,
"schema": { "type": "string" }
},
{
"description": "Indicates if the age is wanted in the response object",
"in": "query",
"name": "wantAge",
"schema": {
"type": "boolean"
}
}
],
"responses": {
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
},
"application/xml": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"200": {
"description": "Expected response to a valid request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Pet" }
},
"application/xml": {
"schema": { "$ref": "#/components/schemas/Pet" }
}
}
}
}
}
},
"/pets": {
"get": {
"operationId": "listPets",
"summary": "List all pets",
"tags": [ "pets" ],
"parameters": [
{
"description": "How many items to return at one time (max 100)",
"in": "query",
"name": "limit",
"required": false,
"schema": { "type": "integer", "format": "int32" }
}
],
"responses": {
"200": {
"description": "An paged array of pets",
"headers": {
"x-next": {
"schema": { "type": "string" },
"description": "A link to the next page of responses"
}
},
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Pets" }
},
"application/xml": {
"schema": { "$ref": "#/components/schemas/Pets" }
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
},
"application/xml": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"post": {
"operationId": "createPets",
"summary": "Create a pet",
"tags": [ "pets" ],
"parameters": [
{
"description": "Turn on/off debug",
"in": "cookie",
"name": "debug",
"schema": {
"type": "integer",
"enum": [0, 1]
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Pet" }
},
"application/x-www-form-urlencoded": {
"schema": { "$ref": "#/components/schemas/Pet" }
}
}
},
"responses": {
"201": {
"description": "Null response",
"content": {
"*/*": {
"schema": { "type": "string" }
}
}
},
"default": {
"description": "unexpected error",
"content": {
"*/*": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
}
},
"components": {
"schemas": {
"Pets": {
"type": "array",
"items": { "$ref": "#/components/schemas/Pet" }
},
"Pet": {
"required": [ "id", "name" ],
"properties": {
"tag": { "type": "string" },
"id": { "type": "integer", "format": "int64" },
"name": { "type": "string" },
"age": { "type": "integer" }
}
},
"Error": {
"required": [ "code", "message" ],
"properties": {
"code": { "format": "int32", "type": "integer" },
"message": { "type": "string" }
}
}
}
}
}