{ "openapi": "3.0.3", "info": { "title": "Pet Store API", "description": "A sample API for a pet store", "version": "1.0.0" }, "servers": [ { "url": "https://api.petstore.example.com/v1", "description": "Production server" }, { "url": "https://staging.petstore.example.com/v1", "description": "Staging server" } ], "paths": { "/pets": { "get": { "summary": "List all pets", "operationId": "listPets", "parameters": [ { "name": "limit", "in": "query", "description": "Maximum number of pets to return", "required": false, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "A paginated list of pets", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pets" } } } }, "400": { "description": "Invalid request" } } }, "post": { "summary": "Create a new pet", "operationId": "createPet", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewPet" } } } }, "responses": { "201": { "description": "Pet created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pet" } } } }, "400": { "description": "Invalid input" } } } }, "/pets/{petId}": { "get": { "summary": "Get a pet by ID", "operationId": "getPet", "parameters": [ { "name": "petId", "in": "path", "description": "ID of the pet to retrieve", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "A pet", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pet" } } } }, "404": { "description": "Pet not found" } } }, "delete": { "summary": "Delete a pet by ID", "operationId": "deletePet", "parameters": [ { "name": "petId", "in": "path", "description": "ID of the pet to delete", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "204": { "description": "Pet deleted" }, "404": { "description": "Pet not found" } } } }, "/orders": { "get": { "summary": "List all orders", "operationId": "listOrders", "responses": { "200": { "description": "A list of orders", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } } } } } } } }, "/orders/{orderId}": { "get": { "summary": "Get an order by ID", "operationId": "getOrder", "parameters": [ { "name": "orderId", "in": "path", "description": "ID of the order to retrieve", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "An order", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } }, "404": { "description": "Order not found" } } }, "delete": { "summary": "Delete an order by ID", "operationId": "deleteOrder", "parameters": [ { "name": "orderId", "in": "path", "description": "ID of the order to delete", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "204": { "description": "Order deleted" }, "404": { "description": "Order not found" } } } }, "/users": { "post": { "summary": "Create a user", "operationId": "createUser", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewUser" } } } }, "responses": { "201": { "description": "User created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } } } } } }, "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" } } }, "Pets": { "type": "array", "items": { "$ref": "#/components/schemas/Pet" } }, "Order": { "type": "object", "required": ["id", "petId", "quantity", "shipDate"], "properties": { "id": { "type": "integer", "format": "int64" }, "petId": { "type": "integer", "format": "int64" }, "quantity": { "type": "integer", "format": "int32" }, "shipDate": { "type": "string", "format": "date-time" }, "status": { "type": "string", "enum": ["placed", "approved", "delivered"] }, "complete": { "type": "boolean" } } }, "User": { "type": "object", "required": ["id", "username"], "properties": { "id": { "type": "integer", "format": "int64" }, "username": { "type": "string" }, "email": { "type": "string" }, "phone": { "type": "string" } } }, "NewUser": { "type": "object", "required": ["username"], "properties": { "username": { "type": "string" }, "email": { "type": "string" }, "phone": { "type": "string" } } } } } }