Skip to content

Instantly share code, notes, and snippets.

@Sean-Bradley
Created April 17, 2019 07:59
Show Gist options
  • Save Sean-Bradley/9864458fbb8a0212101aa03eef81aadd to your computer and use it in GitHub Desktop.
Save Sean-Bradley/9864458fbb8a0212101aa03eef81aadd to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.0",
"info": {
"description": "sean",
"version": "1.0.0",
"title": "Seans-Python3-Flask-Rest-Boilerplate",
"contact": {
"email": "[email protected]"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
},
"servers": [
{
"url": "/"
}
],
"tags": [
{
"name": "Book Request",
"description": "Example API for requesting and return book requests"
}
],
"paths": {
"/request": {
"get": {
"tags": [
"Book Request"
],
"summary": "Returns bookRequests",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/components/schemas/bookRequests"
}
}
}
},
"post": {
"tags": [
"Book Request"
],
"summary": "Create a new book request system",
"requestBody": {
"description": "Book Request Post Object",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/bookRequestPostBody"
}
}
}
},
"produces": [
"application/json"
],
"responses": {
"201": {
"description": "OK",
"schema": {
"$ref": "#/components/schemas/id"
}
},
"400": {
"description": "Failed. Bad post data."
}
}
}
},
"/request/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "ID of the cat that we want to match",
"type": "string"
}
],
"get": {
"tags": [
"Book Request"
],
"summary": "Get book request with given ID",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "Book Request id",
"schema": {
"$ref": "#/components/schemas/id"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/components/schemas/bookRequest"
}
},
"400": {
"description": "Failed. Misunderstood Request."
},
"404": {
"description": "Failed. Book request not found."
}
}
},
"put": {
"summary": "edit a book request by ID",
"tags": [
"Book Request"
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "Book Request id",
"schema": {
"$ref": "#/components/schemas/id"
}
}
],
"requestBody": {
"description": "Book Request Object",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/bookRequest"
}
}
}
},
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/components/schemas/bookRequest"
}
},
"400": {
"description": "Failed. Bad post data."
}
}
},
"delete": {
"summary": "Delete Book Request by ID",
"tags": [
"Book Request"
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "Book Request Id",
"schema": {
"$ref": "#/components/schemas/id"
}
}
],
"responses": {
"204": {
"description": "OK",
"schema": {
"$ref": "#/components/schemas/id"
}
},
"400": {
"description": "Failed. Misunderstood Request."
},
"404": {
"description": "Failed. Book Request not found."
}
}
}
}
},
"components": {
"schemas": {
"id": {
"properties": {
"uuid": {
"type": "string"
}
}
},
"bookRequestPostBody": {
"type": "object",
"properties": {
"title": {
"type": "string",
"format": "string"
},
"email": {
"type": "string",
"format": "email"
}
}
},
"bookRequest": {
"type": "object",
"properties": {
"title": {
"type": "string",
"format": "string"
},
"email": {
"type": "string",
"format": "email"
},
"timestamp": {
"type": "string",
"format": "number"
}
}
},
"bookRequests": {
"type": "object",
"properties": {
"bookRequest": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/bookRequest"
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment