UNPKG

openapi-examples-validator

Version:
185 lines (184 loc) 4.71 kB
{ "openapi": "3.0.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "license": { "name": "MIT" } }, "servers": [ { "url": "http://petstore.swagger.io/v1" } ], "paths": { "/pets": { "post": { "summary": "Create a pet", "operationId": "createPets", "tags": [ "pets" ], "requestBody": { "description": "Pet data", "content": { "application/json": { "schema": { "required": [ "name", "tag" ], "properties": { "name": { "description": "Name of the pet", "type": "string" }, "tag": { "description": "Category of pet", "type": "string" } } }, "examples": { "default": { "summary": "Standard example", "value": { "name": "Herbert", "tag": "Doggo" } } } } } }, "responses": { "201": { "description": "Created pet", "content": { "application/json": { "schema": { "required": [ "id", "name", "tag" ], "properties": { "id": { "description": "Unique ID", "type": "number" }, "name": { "description": "Name of the pet", "type": "string" }, "tag": { "description": "Category of pet", "type": "string" } } }, "example": { "id": 0, "name": "Herbert", "tag": "Doggo" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "required": [ "code", "message" ], "properties": { "code": { "type": "number" }, "message": { "type": "string" } } } } } } } } }, "/pets/{petId}": { "get": { "summary": "Info for a specific pet", "operationId": "showPetById", "tags": [ "pets" ], "parameters": [ { "name": "petId", "in": "path", "required": true, "description": "The id of the pet to retrieve", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Expected response to a valid request", "content": { "application/json": { "schema": { "type": "array", "items": { "required": [ "id", "name" ], "properties": { "id": { "type": "number" }, "name": { "type": "string" }, "tag": { "type": "string" } } } } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "required": [ "code", "message" ], "properties": { "code": { "type": "number" }, "message": { "type": "string" } } } } } } } } } } }