{
	"openapi": "3.1.0",
	"info": {
		"version": "1.0.0",
		"title": "Swagger Petstore",
		"license": {
			"name": "MIT",
			"url": "https://opensource.org/licenses/MIT"
		}
	},
	"servers": [
		{
			"url": "http://petstore.swagger.io/v1"
		}
	],
	"paths": {
		"/{api_version}/pets": {
			"parameters": [
				{
					"$ref": "#/components/parameters/api_version"
				}
			],
			"get": {
				"summary": "List all pets",
				"operationId": "listPets",
				"tags": ["pets"],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"description": "How many items to return at one time (max 100)",
						"required": false,
						"schema": {
							"type": "integer",
							"format": "int32",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "x-sort-order",
						"in": "header",
						"description": "Sort order for the results",
						"required": false,
						"schema": {
							"type": "string",
							"enum": ["asc", "desc"]
						}
					},
					{
						"name": "x-only",
						"in": "header",
						"description": "Only include pets with a tag",
						"required": false,
						"schema": {
							"type": "array",
							"items": {
								"type": "string",
								"enum": ["cat", "dog", "fish", "bird"]
							}
						}
					}
				],
				"responses": {
					"200": {
						"description": "A paged array of pets",
						"headers": {
							"x-next": {
								"description": "A link to the next page of responses",
								"schema": {
									"type": "string"
								}
							}
						},
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Pets"
								}
							},
							"application/xml": {
								"schema": {
									"$ref": "#/components/schemas/Pets"
								}
							}
						}
					},
					"default": {
						"description": "unexpected error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Create a pet",
				"operationId": "createPets",
				"tags": ["pets"],
				"responses": {
					"201": {
						"description": "Null response"
					},
					"default": {
						"description": "unexpected error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								}
							}
						}
					}
				}
			}
		},
		"/cats": {
			"get": {
				"summary": "List all cats",
				"operationId": "listCats",
				"tags": ["pets"],
				"parameters": [
					{
						"name": "limit",
						"in": "query",
						"description": "How many items to return at one time (max 100)",
						"required": false,
						"schema": {
							"type": "integer",
							"format": "int32",
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "x-sort-order",
						"in": "header",
						"description": "Sort order for the results",
						"required": false,
						"schema": {
							"type": "string",
							"enum": ["asc", "desc"]
						}
					}
				],
				"responses": {
					"200": {
						"description": "A paged array of cats",
						"headers": {
							"x-next": {
								"description": "A link to the next page of responses",
								"schema": {
									"type": "string"
								}
							}
						},
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Cats"
								}
							}
						}
					},
					"default": {
						"description": "unexpected error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								}
							}
						}
					}
				}
			}
		},
		"/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"
						}
					},
					{
						"name": "x-api-version",
						"in": "header",
						"required": true,
						"description": "API version to use for this request",
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "Expected response to a valid request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Pet"
								}
							}
						}
					},
					"default": {
						"description": "unexpected error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								}
							}
						}
					}
				}
			}
		},
		"/pets/{petId}/upload": {
			"post": {
				"summary": "Upload pet image and update name",
				"operationId": "uploadPetImage",
				"tags": ["pets"],
				"parameters": [
					{
						"name": "petId",
						"in": "path",
						"required": true,
						"description": "The id of the pet to update",
						"schema": {
							"type": "string"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"multipart/form-data": {
							"schema": {
								"type": "object",
								"required": ["name", "image"],
								"properties": {
									"name": {
										"type": "string",
										"description": "The pet's name"
									},
									"image": {
										"type": "string",
										"format": "binary",
										"description": "The pet's image file"
									}
								}
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Successfully updated pet",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Pet"
								}
							}
						}
					},
					"default": {
						"description": "unexpected error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Error"
								}
							}
						}
					}
				}
			}
		}
	},
	"components": {
		"parameters": {
			"api_version": {
				"name": "api_version",
				"description": "Which version of the API to use.",
				"schema": {
					"type": "string"
				},
				"in": "path"
			},
			"x-api-key": {
        "name": "x-api-key",
        "description": "API key to authenticate requests.",
        "schema": {
          "type": "string"
        },
        "in": "header"
      }
		},
		"schemas": {
			"Allergies": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"const": "allergies"
					}
				},
				"required": ["type"]
			},
			"Diet": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"const": "diet"
					}
				},
				"required": ["type"]
			},
			"Health": {
				"type": "object",
				"oneOf": [
					{ "$ref": "#/components/schemas/Allergies" },
					{ "$ref": "#/components/schemas/Diet" }
				],
				"discriminator": {
					"propertyName": "type"
				}
			},
			"VaccineRecord": {
				"type": "object",
				"required": ["date_administered"],
				"properties": {
					"date_administered": {
						"type": "string",
						"format": "date"
					},
					"veterinarian": {
						"type": "string"
					}
				}
			},
			"PetVaccinations": {
				"type": "object",
				"additionalProperties": {
					"type": "array",
					"items": {
						"$ref": "#/components/schemas/VaccineRecord"
					}
				}
			},
			"Pet": {
				"type": "object",
				"required": ["id", "name"],
				"properties": {
					"id": {
						"type": "integer",
						"format": "int64"
					},
					"name": {
						"type": "string"
					},
					"allergies": {
						"$ref": "#/components/schemas/Health"
					},
					"vaccinations": {
						"$ref": "#/components/schemas/PetVaccinations"
					},
					"tag": {
						"type": "string"
					}
				}
			},
			"Cat": {
				"allOf": [
					{
						"$ref": "#/components/schemas/Pet"
					},
					{
						"type": "object",
						"required": ["lives"],
						"properties": {
							"lives": {
								"type": "integer",
								"format": "int32",
								"minimum": 1,
								"maximum": 9
							},
							"favoriteToy": {
								"type": "string"
							}
						}
					}
				]
			},
			"Pets": {
				"type": "array",
				"items": {
					"$ref": "#/components/schemas/Pet"
				}
			},
			"Cats": {
				"type": "array",
				"items": {
					"$ref": "#/components/schemas/Cat"
				}
			},
			"Error": {
				"type": "object",
				"required": ["code", "message"],
				"properties": {
					"code": {
						"type": "integer",
						"format": "int32"
					},
					"message": {
						"type": "string"
					}
				}
			}
		}
	}
}
