test-openapi.json•5.83 kB
{
"openapi": "3.0.3",
"info": {
"title": "Pet Store API",
"description": "A simple API for managing pets",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.petstore.com/v1",
"description": "Production server"
}
],
"paths": {
"/pets": {
"get": {
"operationId": "getPets",
"summary": "List all pets",
"description": "Retrieve a list of all pets in the store",
"parameters": [
{
"name": "limit",
"in": "query",
"description": "Maximum number of pets to return",
"required": false,
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 20
}
},
{
"name": "tag",
"in": "query",
"description": "Filter pets by tag",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A list of pets",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
},
"post": {
"operationId": "createPet",
"summary": "Create a new pet",
"description": "Add a new pet to the store",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewPet"
}
}
}
},
"responses": {
"201": {
"description": "Pet created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
},
"/pets/{id}": {
"get": {
"operationId": "getPetById",
"summary": "Get a specific pet",
"description": "Retrieve a pet by its ID",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Pet ID",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "Pet details",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"404": {
"description": "Pet not found"
}
}
},
"put": {
"operationId": "updatePet",
"summary": "Update a pet",
"description": "Update an existing pet's information",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Pet ID",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewPet"
}
}
}
},
"responses": {
"200": {
"description": "Pet updated successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
},
"delete": {
"operationId": "deletePet",
"summary": "Delete a pet",
"description": "Remove a pet from the store",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Pet ID",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"204": {
"description": "Pet deleted successfully"
},
"404": {
"description": "Pet not found"
}
}
}
}
},
"components": {
"schemas": {
"Pet": {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "Unique identifier for the pet"
},
"name": {
"type": "string",
"description": "Pet name"
},
"tag": {
"type": "string",
"description": "Pet category tag"
},
"status": {
"type": "string",
"enum": ["available", "pending", "sold"],
"description": "Pet status in the store"
}
}
},
"NewPet": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"type": "string",
"description": "Pet name"
},
"tag": {
"type": "string",
"description": "Pet category tag"
},
"status": {
"type": "string",
"enum": ["available", "pending", "sold"],
"default": "available",
"description": "Pet status in the store"
}
}
}
}
}
}