Created
June 14, 2024 14:05
-
-
Save vicradon/eafab7fa78b0b8f1b83c1a864abeb727 to your computer and use it in GitHub Desktop.
Petstore OAI Spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "Petstore", | |
"description": "The Petstore API but using Express.js", | |
"license": { | |
"name": "MIT", | |
"url": "https://opensource.org/licenses/MIT" | |
} | |
}, | |
"host": "petstore-e7b0.onrender.com", | |
"basePath": "/v1", | |
"tags": [ | |
{ | |
"name": "User", | |
"description": "API for users in the system" | |
}, | |
{ | |
"name": "Pet", | |
"description": "API for pets in the system" | |
}, | |
{ | |
"name": "Store", | |
"description": "API for store operations" | |
} | |
], | |
"schemes": ["https"], | |
"consumes": ["application/json"], | |
"produces": ["application/json"], | |
"paths": { | |
"/pet": { | |
"get": { | |
"tags": ["Pet"], | |
"summary": "Get all pets in the system", | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/Pets" | |
} | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
}, | |
"post": { | |
"tags": ["Pet"], | |
"summary": "Create a new pet", | |
"parameters": [ | |
{ | |
"name": "pet", | |
"in": "body", | |
"description": "Pet object to be added to the store", | |
"required": true, | |
"schema": { | |
"$ref": "#/definitions/Pet" | |
} | |
} | |
], | |
"responses": { | |
"201": { | |
"description": "Created", | |
"schema": { | |
"$ref": "#/definitions/Pet" | |
} | |
}, | |
"400": { | |
"description": "Bad Request" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
} | |
}, | |
"/pet/{petId}": { | |
"get": { | |
"tags": ["Pet"], | |
"summary": "Get a pet by its ID", | |
"parameters": [ | |
{ | |
"name": "petId", | |
"in": "path", | |
"description": "ID of the pet", | |
"required": true, | |
"type": "integer" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/Pet" | |
} | |
}, | |
"404": { | |
"description": "Pet not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
}, | |
"put": { | |
"tags": ["Pet"], | |
"summary": "Update a pet by its ID", | |
"parameters": [ | |
{ | |
"name": "petId", | |
"in": "path", | |
"description": "ID of the pet", | |
"required": true, | |
"type": "integer" | |
}, | |
{ | |
"name": "pet", | |
"in": "body", | |
"description": "Updated pet object", | |
"required": true, | |
"schema": { | |
"$ref": "#/definitions/Pet" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/Pet" | |
} | |
}, | |
"404": { | |
"description": "Pet not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
}, | |
"delete": { | |
"tags": ["Pet"], | |
"summary": "Delete a pet by its ID", | |
"parameters": [ | |
{ | |
"name": "petId", | |
"in": "path", | |
"description": "ID of the pet", | |
"required": true, | |
"type": "integer" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/Pet" | |
} | |
}, | |
"404": { | |
"description": "Pet not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
} | |
}, | |
"/user": { | |
"get": { | |
"tags": ["User"], | |
"summary": "Fetches a list of all users", | |
"responses": { | |
"200": { | |
"description": "Retrieved", | |
"schema": { | |
"$ref": "#/definitions/Users" | |
} | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
}, | |
"post": { | |
"tags": ["User"], | |
"summary": "Create a new user", | |
"parameters": [ | |
{ | |
"name": "user", | |
"in": "body", | |
"description": "User object to be created", | |
"required": true, | |
"schema": { | |
"$ref": "#/definitions/User" | |
} | |
} | |
], | |
"responses": { | |
"201": { | |
"description": "Created", | |
"schema": { | |
"$ref": "#/definitions/User" | |
} | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
} | |
}, | |
"/user/{username}": { | |
"get": { | |
"tags": ["User"], | |
"summary": "Get a user by username", | |
"parameters": [ | |
{ | |
"name": "username", | |
"in": "path", | |
"description": "Username of the user", | |
"required": true, | |
"type": "string" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/User" | |
} | |
}, | |
"404": { | |
"description": "User not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
}, | |
"put": { | |
"tags": ["User"], | |
"summary": "Update a user by username", | |
"parameters": [ | |
{ | |
"name": "username", | |
"in": "path", | |
"description": "Username of the user", | |
"required": true, | |
"type": "string" | |
}, | |
{ | |
"name": "user", | |
"in": "body", | |
"description": "Updated user object", | |
"required": true, | |
"schema": { | |
"$ref": "#/definitions/User" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/User" | |
} | |
}, | |
"404": { | |
"description": "User not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
}, | |
"delete": { | |
"tags": ["User"], | |
"summary": "Delete a user by username", | |
"parameters": [ | |
{ | |
"name": "username", | |
"in": "path", | |
"description": "Username of the user", | |
"required": true, | |
"type": "string" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/User" | |
} | |
}, | |
"404": { | |
"description": "User not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
} | |
}, | |
"/store/order": { | |
"post": { | |
"tags": ["Store"], | |
"summary": "Place an order for a pet", | |
"parameters": [ | |
{ | |
"name": "order", | |
"in": "body", | |
"description": "Order object with petId and quantity", | |
"required": true, | |
"schema": { | |
"$ref": "#/definitions/Order" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/Order" | |
} | |
}, | |
"400": { | |
"description": "Bad Request" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
} | |
}, | |
"/store/order/{orderId}": { | |
"get": { | |
"tags": ["Store"], | |
"summary": "Find a purchase by Order Id", | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"description": "ID of the order", | |
"required": true, | |
"type": "integer" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/Order" | |
} | |
}, | |
"404": { | |
"description": "Order not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
}, | |
"delete": { | |
"tags": ["Store"], | |
"summary": "Delete purchase by Order Id", | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"description": "ID of the order", | |
"required": true, | |
"type": "integer" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"$ref": "#/definitions/Order" | |
} | |
}, | |
"404": { | |
"description": "Order not found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
} | |
}, | |
"/store/inventory": { | |
"get": { | |
"tags": ["Store"], | |
"summary": "Returns pet inventories by status", | |
"responses": { | |
"200": { | |
"description": "OK", | |
"schema": { | |
"type": "object", | |
"additionalProperties": { | |
"type": "integer", | |
"format": "int32" | |
} | |
} | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
} | |
} | |
} | |
}, | |
"definitions": { | |
"Pet": { | |
"type": "object", | |
"required": ["name", "status"], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"uniqueItems": true | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"status": { | |
"type": "string" | |
} | |
} | |
}, | |
"Pets": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/Pet" | |
} | |
}, | |
"User": { | |
"type": "object", | |
"required": [ | |
"id", | |
"username", | |
"firstName", | |
"lastName", | |
"password", | |
"phone", | |
"userStatus" | |
], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"uniqueItems": true | |
}, | |
"username": { | |
"type": "string" | |
}, | |
"firstName": { | |
"type": "string" | |
}, | |
"lastName": { | |
"type": "string" | |
}, | |
"password": { | |
"type": "string" | |
}, | |
"phone": { | |
"type": "string" | |
}, | |
"userStatus": { | |
"type": "integer", | |
"format": "int32", | |
"enum": [0, 1] | |
} | |
} | |
}, | |
"Order": { | |
"type": "object", | |
"required": ["petId", "quantity", "shipDate"], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"uniqueItems": true | |
}, | |
"petId": { | |
"type": "integer" | |
}, | |
"quantity": { | |
"type": "integer" | |
}, | |
"shipDate": { | |
"type": "string", | |
"format": "date-time" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment