From 4788649163defec400a2e36af13b84f60ee996ce Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 4 Dec 2023 19:58:00 +0100 Subject: [PATCH] Base openapi --- Documents/proto/general/openapi.yaml | 158 +++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documents/proto/general/openapi.yaml diff --git a/Documents/proto/general/openapi.yaml b/Documents/proto/general/openapi.yaml new file mode 100644 index 0000000..4c74faa --- /dev/null +++ b/Documents/proto/general/openapi.yaml @@ -0,0 +1,158 @@ +openapi: 3.0.0 +info: + title: ClydeAPI + description: Clyde's api + version: 0.0.1 + +servers: + - url: https://clyde.herisson.ovh/api + description: default api point for clyde's service + +paths: + /ping: + get: + summary: Test if the api is up. + responses: + default: + description: Standard response to ping + content: + text/plain: + schema: + type: string + example: pong + /user: + put: + summary: create a new user + tags: + - users + security: + - bearer: [] + responses: + '200': + description: User created + '401': + $ref: '#/components/responses/UnauthorizedError' + /user/{mat}: + get: + summary: get user's info + tags: + - users + responses: + '200': + description: User found + content: + application/json: + schema: + $ref: "#/components/schemas/User" + parameters: + - name: mat + in: path + description: Matricule of the user (unique id) + required: true + schema: + type: integer + + /cursus/{id}: + get: + summary: Voir les informations sur un Cursus + tags: + - Courses + responses: + '200': + description: Cursus found + content: + application/json: + schema: + $ref: '#/components/schemas/Cursus' + /courses/{id}: + get: + summary: Voir les informations sur un cours* + tags: + - Courses + responses: + + put: + summary: Créer un nouveau cours + tags: + - Courses + security: + - bearer: [] + responses: + + delete: + summary: Suprimer un cours + tags: + - Courses + security: + - bearer: [] + responses: + + +components: + securitySchemes: + bearer: + type: http + scheme: bearer + schemas: + User: + type: object + properties: + RegNo: + type: integer + Photo: + type: object + LastName: + type: string + FirstName: + type: string + Email: + type: string + Address: + $ref: "#/components/schemas/Address" + BirthDate: + type: string + description: Follow the iso 8601 ("YYYY-MM-DD") + StaffMember: + type: boolean + example: + { + "RegNo": 42, + "LastName": "Doe" , + "FirstName": "John", + "Email": "John.Doe@example.com", + "Address": { + "Address": "Rue de Tounais 42", + "Country": "BE"}, + "BirthDate": "1941-02-22", + "StaffMember": true + } + Address: + type: object + properties: + Address: + type: string + Country: + type: string + description: Follow the ISO-3166-1 alpha-2 standard. + example: + { + "Address": "Rue de Tounais 42", + "Country": "BE" + } + Cursus: + type: object + properties: + Id: + type: integer + Courses: + type: array + items: + type: string + example: + { + "id": 42, + "courses": ['Math', 'Info'] + } + responses: + UnauthorizedError: + description: Access token is missing or invalid