91 lines
2.2 KiB
JSON
91 lines
2.2 KiB
JSON
{
|
|
"openapi": "3.0.1",
|
|
"info": {
|
|
"title": "Pets API",
|
|
"version": "1.0.0",
|
|
"description": "API for managing pets."
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "https://api.yourdomain.com"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/pets": {
|
|
"patch": {
|
|
"summary": "Update a pet. Call this with either details for a dog or a cat but not both.",
|
|
"description": "Update a pet. Call this with either details for a dog or a cat but not both.",
|
|
"operationId": "updatePet",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"oneOf": [
|
|
{ "$ref": "#/components/schemas/Cat" },
|
|
{ "$ref": "#/components/schemas/Dog" }
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Updated"
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Create a pet. Call this with either details for a dog or a cat but not both.",
|
|
"description": "Create a pet. Call this with either details for a dog or a cat but not both.",
|
|
"operationId": "createPet",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"oneOf": [
|
|
{ "$ref": "#/components/schemas/Cat" },
|
|
{ "$ref": "#/components/schemas/Dog" }
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"Dog": {
|
|
"type": "object",
|
|
"description": "A representation of a dog. Do not use for a cat.",
|
|
"properties": {
|
|
"bark": {
|
|
"type": "boolean"
|
|
},
|
|
"breed": {
|
|
"type": "string",
|
|
"enum": [ "Dingo", "Husky", "Retriever", "Shepherd" ]
|
|
}
|
|
}
|
|
},
|
|
"Cat": {
|
|
"type": "object",
|
|
"description": "A representation of a cat. Do not use for a dog.",
|
|
"properties": {
|
|
"hunts": {
|
|
"type": "boolean"
|
|
},
|
|
"age": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|