174 lines
4.2 KiB
JSON
174 lines
4.2 KiB
JSON
{
|
|
"openapi": "3.0.3",
|
|
"info": {
|
|
"title": "Petstore",
|
|
"version": "1.0.0",
|
|
"description": "A minimal Petstore API for testing."
|
|
},
|
|
"security": [
|
|
{ "api_key": [] }
|
|
],
|
|
"tags": [
|
|
{ "name": "pets", "description": "Pet operations" },
|
|
{ "name": "store", "description": "Store operations" }
|
|
],
|
|
"paths": {
|
|
"/pets": {
|
|
"get": {
|
|
"operationId": "listPets",
|
|
"summary": "List all pets",
|
|
"tags": ["pets"],
|
|
"parameters": [
|
|
{
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": false,
|
|
"description": "Maximum number of items to return"
|
|
},
|
|
{
|
|
"name": "offset",
|
|
"in": "query",
|
|
"required": false,
|
|
"description": "Pagination offset"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "A list of pets",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/components/schemas/Pet" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"operationId": "createPet",
|
|
"summary": "Create a pet",
|
|
"tags": ["pets"],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": { "$ref": "#/components/schemas/NewPet" }
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Pet created",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": { "$ref": "#/components/schemas/Pet" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/pets/{petId}": {
|
|
"parameters": [
|
|
{
|
|
"name": "petId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The ID of the pet"
|
|
}
|
|
],
|
|
"get": {
|
|
"operationId": "showPetById",
|
|
"summary": "Get a pet by ID",
|
|
"tags": ["pets"],
|
|
"responses": {
|
|
"200": {
|
|
"description": "A single pet",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": { "$ref": "#/components/schemas/Pet" }
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Pet not found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": { "$ref": "#/components/schemas/Error" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"operationId": "deletePet",
|
|
"summary": "Delete a pet",
|
|
"tags": ["pets"],
|
|
"deprecated": true,
|
|
"responses": {
|
|
"204": { "description": "Pet deleted" }
|
|
}
|
|
}
|
|
},
|
|
"/store/inventory": {
|
|
"get": {
|
|
"operationId": "getInventory",
|
|
"summary": "Get store inventory",
|
|
"tags": ["store"],
|
|
"security": [],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Inventory counts",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": { "type": "integer" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"Pet": {
|
|
"type": "object",
|
|
"required": ["id", "name"],
|
|
"properties": {
|
|
"id": { "type": "integer", "format": "int64" },
|
|
"name": { "type": "string" },
|
|
"tag": { "type": "string" }
|
|
}
|
|
},
|
|
"NewPet": {
|
|
"type": "object",
|
|
"required": ["name"],
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"tag": { "type": "string" }
|
|
}
|
|
},
|
|
"Error": {
|
|
"type": "object",
|
|
"required": ["code", "message"],
|
|
"properties": {
|
|
"code": { "type": "integer", "format": "int32" },
|
|
"message": { "type": "string" }
|
|
}
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"api_key": {
|
|
"type": "apiKey",
|
|
"name": "X-API-Key",
|
|
"in": "header"
|
|
}
|
|
}
|
|
}
|
|
}
|