Skip to content
Snippets Groups Projects
Commit 800faa60 authored by Alex Moulton's avatar Alex Moulton
Browse files

chore:Created BackendAPI schemas

parent b183f9fa
No related branches found
No related tags found
No related merge requests found
Pipeline #1694757440 failed
---
openapi: 3.0.3
servers:
- url: 'http/localhost'
info:
title: InventoryBackend
version: 0.1.0
description: Category-Based Inventory information for Thea's Pantry.
contact:
name: Thea's Pantry
email: info@librefoodpantry.org
url: librefoodpantry.org
tags:
- name: inventory
description: Category Based Inventory to Thea's Pantry
- name: version
description: API version
paths:
/inventory:
get:
description: Gets an array of the categories in the inventory
tags:
- inventory
operationId: getInventory
responses:
'200':
description: OK
content:
application.json:
schema:
$ref: '#/components/schemas/Inventory'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/ServerError'
post:
description: Creates a category
tags:
- inventory
operationId: createCategory
x-eov-operation-handler: endpoints
requestBody:
content:
application/json:
example:
id: I001
name : Beverages
stock: 120
schema:
$ref: '#/components/schemas/Category'
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/Category'
description: Created
'400':
$ref: '#/components/responses/BadRequest'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/ServerError'
'/inventory/{categoryName}':
description: Specific category in inventory
parameters:
- name: categoryName
in: path
required: true
description: Name of the category
schema:
$ref: '#/components/schemas/CategoryName'
put:
description: Updates a Category
tags:
- inventory
operationId: updateCategory
x-eov-operation-handler:
requestBody:
content:
application/json:
example:
id: I001
name : Beverages
stock: 120
schema:
$ref: '#/components/schemas/Category'
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/Category'
description: Created
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
get:
description: Gets the category in the inventory
tags:
- inventory
operationId: getCategory
responses:
'200':
description: OK
content:
application.json:
schema:
$ref: '#/components/schemas/Category'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/ServerError'
delete:
description: Deletes a category
tags:
- inventory
operationId: deleteCategory
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/ServerError'
/version:
get:
description: Get current API version number
tags:
- inventory
operationId: getAPIVersion
x-eov-operation-handler: endpoints
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIVersion'
'500':
$ref: '#/components/responses/ServerError'
components:
responses:
Conflict:
description: Object already exists
content:
application/json:
schema:
$ref: '#/components/schemas/EovError'
Unauthorized:
description: No valid token was found
content:
application/json:
schema:
$ref: '#/components/schemas/EovError'
BadRequest:
description: Request was malformed
content:
application/json:
schema:
$ref: '#/components/schemas/EovError'
ServerError:
description: There was an error in the servers
content:
application/json:
schema:
$ref: '#/components/schemas/EovError'
NotFound:
description: The specified resource was not found
content:
application/json:
schema:
$ref: '#/components/schemas/EovError'
schemas:
EovError:
description: Not Acceptable
type: object
example:
message: '.response should have required property''name'', .response should have required property ''id'''
errors:
- path: .response.name
message: should have required property 'name'
errorCode: required.openapi.validation
- path: .response.id
message: should have required property 'id'
errorCode: required.openapi.validation
CategoryId:
description: Database's Id for the category
type: string
CategoryName:
description: Name of the category
type: string
CategoryStock:
description: COunt of the stock of the category
type: integer
Category:
example:
id: I001
name: Beverages
stock: 5
properties:
id:
$ref: '#/components/schemas/CategoryId'
name:
$ref: '#/components/schemas/CategoryName'
stock:
$ref: '#/components/schemas/CategoryStock'
required:
- id
- name
- stock
Inventory:
description: Collection of the categories
type: array
nullable: false
items:
$ref: '#/components/schemas/Category'
APIVersion:
example: 1.2.3
description: Current operating version of the API
# yamllint disable-line rule:line-length
pattern: ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
type: string
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment