Skip to content

Instantly share code, notes, and snippets.

@VisualBean
Created July 28, 2020 18:58
Show Gist options
  • Save VisualBean/cfd13bf6295b64a0759705e2d1d5a687 to your computer and use it in GitHub Desktop.
Save VisualBean/cfd13bf6295b64a0759705e2d1d5a687 to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.1",
"info": {
"title": "PetStore API",
"version": "v1"
},
"paths": {
"/api/PetStore": {
"get": {
"tags": [
"PetStore"
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
},
"post": {
"tags": [
"PetStore"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"responses": {
"201": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"/api/PetStore/{id}": {
"get": {
"tags": [
"PetStore"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
},
"put": {
"tags": [
"PetStore"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
},
"delete": {
"tags": [
"PetStore"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "Success"
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Tag": {
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"PetStatus": {
"enum": [
0,
1
],
"type": "integer",
"format": "int32"
},
"Pet": {
"type": "object",
"properties": {
"id": {
"maximum": 100,
"minimum": 0,
"type": "integer",
"format": "int32",
"readOnly": true
},
"name": {
"maxLength": 15,
"minLength": 2,
"type": "string",
"nullable": true
},
"photoUrl": {
"type": "string",
"format": "uri",
"nullable": true
},
"tags": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Tag"
},
"nullable": true
},
"status": {
"$ref": "#/components/schemas/PetStatus"
}
},
"additionalProperties": false
},
"ProblemDetails": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
},
"additionalProperties": {
"type": "object",
"additionalProperties": false
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment