{ "openapi": "3.1.0", "info": { "title": "Petstore API", "version": "1.0.0", "description": "A sample API that uses a petstore as an example" }, "servers": [ { "url": "http://localhost:3000/v3" } ], "tags": [ { "name": "pets", "description": "Pet operations" }, { "name": "store", "description": "Store operations" } ], "paths": { "/pets": { "get": { "summary": "List all pets", "operationId": "listPets", "tags": ["pets"], "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "format": "int32", "minimum": 1, "maximum": 100 } }, { "name": "offset", "in": "query", "required": false, "schema": { "type": "integer", "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "A list of pets", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Pet" } } } } } } }, "post": { "summary": "Create a pet", "operationId": "createPet", "tags": ["pets"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatePetBody" } } } }, "responses": { "201": { "description": "Pet created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pet" } } } }, "400": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/pets/{petId}": { "get": { "summary": "Find pet by ID", "operationId": "showPetById", "tags": ["pets"], "parameters": [ { "name": "petId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Pet found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pet" } } } }, "404": { "description": "Pet not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "put": { "summary": "Update a pet", "operationId": "updatePet", "tags": ["pets"], "parameters": [ { "name": "petId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdatePetBody" } } } }, "responses": { "200": { "description": "Pet updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pet" } } } }, "400": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Pet not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "summary": "Delete a pet", "operationId": "deletePet", "tags": ["pets"], "parameters": [ { "name": "petId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "204": { "description": "Pet deleted" }, "404": { "description": "Pet not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/store/inventory": { "get": { "summary": "Returns pet inventories by status", "operationId": "getInventory", "tags": ["store"], "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": { "type": "integer", "format": "int32" } } } } } } } } }, "components": { "schemas": { "Pet": { "type": "object", "required": ["id", "name"], "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "tag": { "type": "string" }, "status": { "type": "string", "enum": ["available", "pending", "sold"] } } }, "CreatePetBody": { "type": "object", "required": ["name"], "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "tag": { "type": "string" } } }, "UpdatePetBody": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "tag": { "type": "string" }, "status": { "type": "string", "enum": ["available", "pending", "sold"] } } }, "Error": { "type": "object", "required": ["code", "message"], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } }