406 lines
10 KiB
JSON
406 lines
10 KiB
JSON
{
|
|
"openapi": "3.0.1",
|
|
"info": {
|
|
"title": "Simple Pizza Api",
|
|
"description": "A simple ASP.NET Core Web Api application with CRUD including Patch that allows you to work with pizza data",
|
|
"contact": {
|
|
"name": "Kathleen West",
|
|
"url": "https://portfolio.katiegirl.net",
|
|
"email": "hello.kathleen.west@gmail.com"
|
|
},
|
|
"license": {
|
|
"name": "MIT License",
|
|
"url": "https://opensource.org/licenses/MIT"
|
|
},
|
|
"version": "v1"
|
|
},
|
|
"paths": {
|
|
"/error": {
|
|
"get": {
|
|
"tags": [
|
|
"Error"
|
|
],
|
|
"operationId": "Error",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/Pizza": {
|
|
"get": {
|
|
"tags": [
|
|
"Pizza"
|
|
],
|
|
"summary": "Get all the pizza model objects in memory",
|
|
"operationId": "GetAll",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Pizza"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Pizza"
|
|
],
|
|
"summary": "Creates a pizza and automatically assigns a unique identifier (int)",
|
|
"operationId": "Create",
|
|
"requestBody": {
|
|
"description": "(Pizza) pizza model object",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Pizza"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/Pizza/{id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Pizza"
|
|
],
|
|
"summary": "Get one specific pizza given a unique identifier (int)",
|
|
"operationId": "Get",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "(int) unique identifier of the pizza",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Pizza"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"tags": [
|
|
"Pizza"
|
|
],
|
|
"summary": "Updates a specific pizza given a unique identifier (int), if it exists",
|
|
"operationId": "Update",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "(int) unique identifier of the pizza",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "(Pizza) pizza to delete",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Pizza"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content"
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"tags": [
|
|
"Pizza"
|
|
],
|
|
"summary": "Updates properties of a specific pizza given a unique identifier (int), if it exists",
|
|
"operationId": "Patch",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "(int) unique identifier of the pizza",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "(JsonPatchDocument) patch of operations",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Operation"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content"
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"tags": [
|
|
"Pizza"
|
|
],
|
|
"summary": "Delete a specific pizza given a unique identifier, if it exists",
|
|
"operationId": "Delete",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "(int) identifier of the pizza",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content"
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/errorDemo/{id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Pizza"
|
|
],
|
|
"summary": "Demo of Custom Error Handling for Get Operation",
|
|
"operationId": "GetErrorDemo",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"description": "(int) unique identifier of the pizza",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"500": {
|
|
"description": "Server Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"AuditHistory": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"createdBy": {
|
|
"type": "string",
|
|
"nullable": true
|
|
},
|
|
"createdDate": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"Operation": {
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {
|
|
"nullable": true
|
|
},
|
|
"path": {
|
|
"type": "string",
|
|
"nullable": true
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"nullable": true
|
|
},
|
|
"from": {
|
|
"type": "string",
|
|
"nullable": true
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"Pizza": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"description": "Unique Identifier (int) \r\nfor Pizza",
|
|
"format": "int32"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of the Pizza (string)",
|
|
"nullable": true
|
|
},
|
|
"isGlutenFree": {
|
|
"type": "boolean",
|
|
"description": "Is this Pizza Gluten Free\r\n(bool true --> yes)"
|
|
},
|
|
"auditHistory": {
|
|
"$ref": "#/components/schemas/AuditHistory"
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"description": "Simple Pizza"
|
|
},
|
|
"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": { }
|
|
}
|
|
}
|
|
}
|
|
} |