From 74edc206419e396293df9836cdf47548a110be38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Thu, 17 Dec 2020 01:15:24 +0100 Subject: [PATCH] Specifikace pro posty --- openapi.yaml | 137 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 128 insertions(+), 9 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index b987b6c..65e0749 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -19,6 +19,11 @@ servers: description: Production server components: + securitySchemes: + Bearer: + name: Authorization + in: header + type: apiKey schemas: ProgramScheduleEntry: type: object @@ -39,22 +44,83 @@ components: description: type: string nullable: true - expectedStartAt: + expected_start_at: type: string - expectedFinishAt: + expected_finish_at: type: string nullable: true - securitySchemes: - Bearer: - name: Authorization - in: header - type: apiKey + Ranking: + type: object + properties: + score: + type: integer + likes: + type: integer + dislikes: + type: integer + my_vote: + type: integer + Author: + type: object + properties: + name: + type: string + group: + type: string + DiscussionPost: + type: object + description: Prispevek do rozpravy + properties: + id: + type: integer + readOnly: true + datetime: + type: string + is_archived: + type: boolean + content: + type: string + author: + $ref: '#/components/schemas/Author' + ranking: + $ref: '#/components/schemas/Ranking' + ProposalPost: + type: object + description: NavrhPostupu + properties: + id: + type: integer + readOnly: true + datetime: + type: string + is_archived: + type: boolean + content: + type: string + author: + $ref: '#/components/schemas/Author' + ranking: + $ref: '#/components/schemas/Ranking' +# responses: +# Unauthorized: +# description: Unauthorized +# schema: +# $ref: '#/definitions/ErrorResponse' +# Forbidden: +# description: Forbidden +# schema: +# $ref: '#/definitions/ErrorResponse' +# NotFound: +# description: The specified resource was not found +# schema: +# $ref: '#/definitions/ErrorResponse' paths: /program: get: + x-mojo-to: program#entries tags: - - program + - programm summary: "Program zasedani" operationId: getProgram responses: @@ -66,4 +132,57 @@ paths: type: array items: $ref: '#/components/schemas/ProgramScheduleEntry' - x-mojo-to: program#entries + /posts: + post: + x-mojo-to: posts#create + security: + - Bearer: ['member', 'regp'] + tags: + - posts + summary: "Pridat zpravu" + operationId: createPost + requestBody: + content: + application/json: + schema: + type: object + properties: + type: + type: integer + enum: [0, 1] + content: + type: string + required: + - type + - content + responses: + 201: + description: Post created + content: + application/json: + schema: + type: object + properties: + id: + type: integer + description: Post id + + get: + x-mojo-to: posts#list + security: + - Bearer: [] + tags: + - posts + summary: "Zpravy" + operationId: getPosts + responses: + 200: + description: Posts + content: + application/json: + schema: + type: array + items: + oneOf: + - $ref: '#/components/schemas/DiscussionPost' + - $ref: '#/components/schemas/ProposalPost' -- GitLab