Skip to content

Instantly share code, notes, and snippets.

@samuelsolis
Created March 17, 2023 12:27
Show Gist options
  • Save samuelsolis/9efffc9bfc1532da34461203304a1e95 to your computer and use it in GitHub Desktop.
Save samuelsolis/9efffc9bfc1532da34461203304a1e95 to your computer and use it in GitHub Desktop.
openapi.json versión 3
{
"openapi": "3.0.3",
"info": {
"title": "Swagger Petstore - OpenAPI 3.0",
"description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification. ",
"version": "1.0.11"
},
"servers": [
{
"url": "https://petstore3.swagger.io/api/v3"
}
],
"paths": {
"/color": {
"post": {
"tags": [
"color"
],
"summary": "Add a new color",
"description": "Add a new color. Hex is the identifier, cannot be duplicated.",
"operationId": "AddColor",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Color"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Color"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/Color"
}
}
}
},
"responses": {
"200": {
"description": "Success"
},
"405": {
"description": "Invalid input"
}
}
}
},
"/color/{hex}": {
"patch": {
"tags": [
"color"
],
"summary": "Update an existing color",
"operationId": "updateColor",
"parameters": [
{
"in": "path",
"name": "hex",
"schema": {
"type": "integer"
},
"required": true,
"description": "Numeric ID of the user to get"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Color"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Color"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/Color"
}
}
}
},
"responses": {
"405": {
"description": "Invalid input"
}
}
}
}
},
"components": {
"schemas": {
"Color": {
"type": "object",
"required": [
"hex"
],
"properties": {
"hex": {
"type": "string",
"example": "#101014"
},
"name": {
"type": "string",
"example": "red"
},
"price": {
"type": "integer",
"format": "int64"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment