{ "openapi": "3.0.3", "info": { "title": "My Pets API", "description": "Awesome, Mega Cool API to manage Ariel's Pet Leopards!", "version": "0.0.1" }, "paths": { "/categories": { "get": { "tags": [ "Category" ], "summary": "List Categories", "description": "List Categories.", "operationId": "listCategory", "parameters": [ { "name": "page", "in": "query", "description": "what page to render", "schema": { "type": "integer", "minimum": 1 } }, { "name": "itemsPerPage", "in": "query", "description": "item count to render per page", "schema": { "type": "integer", "maximum": 255, "minimum": 1 } } ], "responses": { "200": { "description": "result Category list", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/CategoryList" } } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "post": { "tags": [ "Category" ], "summary": "Create a new Category", "description": "Creates a new Category and persists it to storage.", "operationId": "createCategory", "requestBody": { "description": "Category to create", "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "pets": { "type": "array", "items": { "type": "integer" } } }, "required": [ "name" ] } } }, "required": true }, "responses": { "200": { "description": "Category created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CategoryCreate" } } } }, "400": { "$ref": "#/components/responses/400" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/categories/{id}": { "get": { "tags": [ "Category" ], "summary": "Find a Category by ID", "description": "Finds the Category with the requested ID and returns it.", "operationId": "readCategory", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Category", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Category with requested ID was found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CategoryRead" } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "delete": { "tags": [ "Category" ], "summary": "Deletes a Category by ID", "description": "Deletes the Category with the requested ID.", "operationId": "deleteCategory", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Category", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Category with requested ID was deleted" }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "patch": { "tags": [ "Category" ], "summary": "Updates a Category", "description": "Updates a Category and persists changes to storage.", "operationId": "updateCategory", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Category", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "description": "Category properties to update", "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "pets": { "type": "array", "items": { "type": "integer" } } } } } }, "required": true }, "responses": { "200": { "description": "Category updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CategoryUpdate" } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/categories/{id}/pets": { "get": { "tags": [ "Category" ], "summary": "List attached Pets", "description": "List attached Pets.", "operationId": "listCategoryPets", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Category", "required": true, "schema": { "type": "integer" } }, { "name": "page", "in": "query", "description": "what page to render", "schema": { "type": "integer" } }, { "name": "itemsPerPage", "in": "query", "description": "item count to render per page", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "result Categories list", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Category_PetsList" } } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/pets": { "get": { "tags": [ "Pet" ], "summary": "List Pets", "description": "List Pets.", "operationId": "listPet", "parameters": [ { "name": "page", "in": "query", "description": "what page to render", "schema": { "type": "integer", "minimum": 1 } }, { "name": "itemsPerPage", "in": "query", "description": "item count to render per page", "schema": { "type": "integer", "maximum": 255, "minimum": 1 } } ], "responses": { "200": { "description": "result Pet list", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/PetList" } } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "post": { "tags": [ "Pet" ], "summary": "Create a new Pet", "description": "Creates a new Pet and persists it to storage.", "operationId": "createPet", "requestBody": { "description": "Pet to create", "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" }, "categories": { "type": "array", "items": { "type": "integer" } }, "owner": { "type": "integer" }, "friends": { "type": "array", "items": { "type": "integer" } } }, "required": [ "name" ] } } }, "required": true }, "responses": { "200": { "description": "Pet created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PetCreate" } } } }, "400": { "$ref": "#/components/responses/400" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/pets/{id}": { "get": { "tags": [ "Pet" ], "summary": "Find a Pet by ID", "description": "Finds the Pet with the requested ID and returns it.", "operationId": "readPet", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Pet", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Pet with requested ID was found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PetRead" } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "delete": { "tags": [ "Pet" ], "summary": "Deletes a Pet by ID", "description": "Deletes the Pet with the requested ID.", "operationId": "deletePet", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Pet", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "Pet with requested ID was deleted" }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "patch": { "tags": [ "Pet" ], "summary": "Updates a Pet", "description": "Updates a Pet and persists changes to storage.", "operationId": "updatePet", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Pet", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "description": "Pet properties to update", "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" }, "categories": { "type": "array", "items": { "type": "integer" } }, "owner": { "type": "integer" }, "friends": { "type": "array", "items": { "type": "integer" } } } } } }, "required": true }, "responses": { "200": { "description": "Pet updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PetUpdate" } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/pets/{id}/categories": { "get": { "tags": [ "Pet" ], "summary": "List attached Categories", "description": "List attached Categories.", "operationId": "listPetCategories", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Pet", "required": true, "schema": { "type": "integer" } }, { "name": "page", "in": "query", "description": "what page to render", "schema": { "type": "integer" } }, { "name": "itemsPerPage", "in": "query", "description": "item count to render per page", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "result Pets list", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Pet_CategoriesList" } } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/pets/{id}/friends": { "get": { "tags": [ "Pet" ], "summary": "List attached Friends", "description": "List attached Friends.", "operationId": "listPetFriends", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Pet", "required": true, "schema": { "type": "integer" } }, { "name": "page", "in": "query", "description": "what page to render", "schema": { "type": "integer" } }, { "name": "itemsPerPage", "in": "query", "description": "item count to render per page", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "result Pets list", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Pet_FriendsList" } } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/pets/{id}/owner": { "get": { "tags": [ "Pet" ], "summary": "Find the attached User", "description": "Find the attached User of the Pet with the given ID", "operationId": "readPetOwner", "parameters": [ { "name": "id", "in": "path", "description": "ID of the Pet", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "User attached to Pet with requested ID was found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pet_OwnerRead" } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/users": { "get": { "tags": [ "User" ], "summary": "List Users", "description": "List Users.", "operationId": "listUser", "parameters": [ { "name": "page", "in": "query", "description": "what page to render", "schema": { "type": "integer", "minimum": 1 } }, { "name": "itemsPerPage", "in": "query", "description": "item count to render per page", "schema": { "type": "integer", "maximum": 255, "minimum": 1 } } ], "responses": { "200": { "description": "result User list", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/UserList" } } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "post": { "tags": [ "User" ], "summary": "Create a new User", "description": "Creates a new User and persists it to storage.", "operationId": "createUser", "requestBody": { "description": "User to create", "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer" }, "pets": { "type": "array", "items": { "type": "integer" } } }, "required": [ "name", "age" ] } } }, "required": true }, "responses": { "200": { "description": "User created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserCreate" } } } }, "400": { "$ref": "#/components/responses/400" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/users/{id}": { "get": { "tags": [ "User" ], "summary": "Find a User by ID", "description": "Finds the User with the requested ID and returns it.", "operationId": "readUser", "parameters": [ { "name": "id", "in": "path", "description": "ID of the User", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "User with requested ID was found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserRead" } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "delete": { "tags": [ "User" ], "summary": "Deletes a User by ID", "description": "Deletes the User with the requested ID.", "operationId": "deleteUser", "parameters": [ { "name": "id", "in": "path", "description": "ID of the User", "required": true, "schema": { "type": "integer" } } ], "responses": { "204": { "description": "User with requested ID was deleted" }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } }, "patch": { "tags": [ "User" ], "summary": "Updates a User", "description": "Updates a User and persists changes to storage.", "operationId": "updateUser", "parameters": [ { "name": "id", "in": "path", "description": "ID of the User", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "description": "User properties to update", "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer" }, "pets": { "type": "array", "items": { "type": "integer" } } } } } }, "required": true }, "responses": { "200": { "description": "User updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserUpdate" } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } }, "/users/{id}/pets": { "get": { "tags": [ "User" ], "summary": "List attached Pets", "description": "List attached Pets.", "operationId": "listUserPets", "parameters": [ { "name": "id", "in": "path", "description": "ID of the User", "required": true, "schema": { "type": "integer" } }, { "name": "page", "in": "query", "description": "what page to render", "schema": { "type": "integer" } }, { "name": "itemsPerPage", "in": "query", "description": "item count to render per page", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "result Users list", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/User_PetsList" } } } } }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "409": { "$ref": "#/components/responses/409" }, "500": { "$ref": "#/components/responses/500" } } } } }, "components": { "schemas": { "Category": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "pets": { "type": "array", "items": { "$ref": "#/components/schemas/Pet" } } }, "required": [ "id", "name" ] }, "CategoryCreate": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } }, "required": [ "id", "name" ] }, "CategoryList": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } }, "required": [ "id", "name" ] }, "CategoryRead": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } }, "required": [ "id", "name" ] }, "CategoryUpdate": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } }, "required": [ "id", "name" ] }, "Category_PetsList": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" } }, "required": [ "id", "name" ] }, "Pet": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" }, "categories": { "type": "array", "items": { "$ref": "#/components/schemas/Category" } }, "owner": { "$ref": "#/components/schemas/User" }, "friends": { "type": "array", "items": { "$ref": "#/components/schemas/Pet" } } }, "required": [ "id", "name" ] }, "PetCreate": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" } }, "required": [ "id", "name" ] }, "PetList": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" } }, "required": [ "id", "name" ] }, "PetRead": { "type": "object", "properties": { "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" }, "owner": { "$ref": "#/components/schemas/PetRead_Owner" } }, "required": [ "name" ] }, "PetRead_Owner": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "age": { "type": "integer" } }, "required": [ "id", "name", "age" ] }, "PetUpdate": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" } }, "required": [ "id", "name" ] }, "Pet_CategoriesList": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } }, "required": [ "id", "name" ] }, "Pet_FriendsList": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" } }, "required": [ "id", "name" ] }, "Pet_OwnerRead": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "age": { "type": "integer" } }, "required": [ "id", "name", "age" ] }, "User": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "age": { "type": "integer" }, "pets": { "type": "array", "items": { "$ref": "#/components/schemas/Pet" } } }, "required": [ "id", "name", "age" ] }, "UserCreate": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "age": { "type": "integer" } }, "required": [ "id", "name", "age" ] }, "UserList": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "age": { "type": "integer" } }, "required": [ "id", "name", "age" ] }, "UserRead": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "age": { "type": "integer" } }, "required": [ "id", "name", "age" ] }, "UserUpdate": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "age": { "type": "integer" } }, "required": [ "id", "name", "age" ] }, "User_PetsList": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "nicknames": { "type": "array", "items": { "type": "string" } }, "age": { "type": "integer" } }, "required": [ "id", "name" ] } }, "responses": { "400": { "description": "invalid input, data invalid", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "integer" }, "status": { "type": "string" }, "errors": {} }, "required": [ "code", "status" ] } } } }, "403": { "description": "insufficient permissions", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "integer" }, "status": { "type": "string" }, "errors": {} }, "required": [ "code", "status" ] } } } }, "404": { "description": "resource not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "integer" }, "status": { "type": "string" }, "errors": {} }, "required": [ "code", "status" ] } } } }, "409": { "description": "conflicting resources", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "integer" }, "status": { "type": "string" }, "errors": {} }, "required": [ "code", "status" ] } } } }, "500": { "description": "unexpected error", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "integer" }, "status": { "type": "string" }, "errors": {} }, "required": [ "code", "status" ] } } } } } } }