Skip to content
Snippets Groups Projects
Commit b1a7f835 authored by BEAUVAIS ANTOINE's avatar BEAUVAIS ANTOINE
Browse files

Added stub OpenAPI specification.

Use https://editor.swagger.io/ to view.
parent 3f921dcc
Branches
1 merge request!8Merge 'develop' into 'master'.
This commit is part of merge request !8. Comments created here will be created in the context of that merge request.
openapi: "3.0.0"
info:
version: 0.0.1-20210924
title: SIL ERP BACK
description: Interface API between the SIL ERP services and the BACK component.
# termsOfService: https://git.unistra.fr/erp-sil/back
contact:
name: Antoine Beauvais
email: antoine.beauvais@etu.unistra.fr
url: https://git.unistra.fr/antoine.beauvais
license:
name: CeCILL-B
url: https://cecill.info/licences/Licence_CeCILL-B_V1-en.html
paths:
/retrieveItems:
get:
description: |
Returns the list of all available items.
It is also possible to filter items by category.
operationId: retrieveItems
parameters:
- name: category
in: query
description: category ID to filter results by
required: false
schema:
type: integer
format: int32
responses:
'200':
description: List of items.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Item'
'204':
description: No Content (no items in the given category)
'400':
description: Bad Request (invalid category parameter)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/retrieveCategories:
get:
description: |
Returns the list of all existing categories.
operationId: retrieveCategories
responses:
'200':
description: List of categories.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Category'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/submitTransaction:
post:
description: Submits a new transaction into the system.
operationId: submitTransaction
requestBody:
description: Transaction to process.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Transaction'
responses:
'201':
description: Created transaction.
content:
application/json:
schema:
$ref: '#/components/schemas/Transaction'
'400':
description: Bad Request (invalid JSON)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
components:
schemas:
Category:
type: object
required:
- id
- name
properties:
id:
type: integer
example: 1
name:
type: string
example: "Boissons"
Item:
type: object
required:
- id
- name
- price
- subscriberPrice
properties:
id:
type: integer
example: 1
name:
type: string
example: "Jus d'orange"
price:
type: number
example: 1.5
subscriberPrice:
type: number
example: 0.8
Transaction:
type: object
required:
- item
- quantity
- amount
properties:
item:
type: integer
example: 1
quantity:
type: integer
example: 5
amount:
type: number
example: 4.0
ErrorMessage:
type: object
required:
- message
properties:
message:
type: string
example: "Database failure."
\ No newline at end of file
...@@ -38,7 +38,6 @@ public class Transaction { ...@@ -38,7 +38,6 @@ public class Transaction {
* Class constructor. * Class constructor.
* @param item Item's identifier. * @param item Item's identifier.
* @param type Transaction type. * @param type Transaction type.
* @param amount Transaction's amount.
* @param quantity Quantity of items involved. * @param quantity Quantity of items involved.
*/ */
public Transaction(Integer item, Integer type, Integer quantity) public Transaction(Integer item, Integer type, Integer quantity)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment