Add warning at the begining of generated openapi file, and commit it.

pull/13/head
Nathanaël Jourdane 4 years ago committed by guhur
parent d02508957c
commit b1c1cee734

@ -1,4 +1,4 @@
openapi: 3.0.0 # This file has been automatically generated. All manual modifications may be lost. See README.md for details.
info: info:
title: Mieux Voter title: Mieux Voter
description: A poll application based on Majority Judgment (MJ). description: A poll application based on Majority Judgment (MJ).
@ -25,7 +25,7 @@ paths:
schema: schema:
type: array type: array
items: items:
$ref: '#/components/schemas/Poll' $ref: '#/components/schemas/poll'
post: post:
operationId: create-poll operationId: create-poll
summary: Creates a poll. summary: Creates a poll.
@ -34,7 +34,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Poll' $ref: '#/components/schemas/poll'
responses: responses:
'201': '201':
description: Created description: Created
@ -47,16 +47,16 @@ paths:
type: string type: string
description: Id of the created poll. description: Id of the created poll.
links: links:
GetPollByPollId: get-poll:
$ref: '#/components/links/GetPollByPollId' $ref: '#/components/links/get-poll'
SetPollByPollId: update-poll:
$ref: '#/components/links/SetPollByPollId' $ref: '#/components/links/update-poll'
DelPollByPollId: delete-poll:
$ref: '#/components/links/DelPollByPollId' $ref: '#/components/links/delete-poll'
JudgeByPollId: create-judgment:
$ref: '#/components/links/JudgeByPollId' $ref: '#/components/links/create-judgment'
ResultsByPollId: list-poll-results:
$ref: '#/components/links/ResultsByPollId' $ref: '#/components/links/list-poll-results'
'400': '400':
description: Bad Request. Expect at least 2 candidates and a title. description: Bad Request. Expect at least 2 candidates and a title.
'/polls/{poll-id}': '/polls/{poll-id}':
@ -76,9 +76,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Poll' $ref: '#/components/schemas/poll'
'404': '404':
$ref: '#/components/responses/PollNotFound' $ref: '#/components/responses/poll-not-found'
patch: patch:
operationId: update-poll operationId: update-poll
summary: Updates a poll summary: Updates a poll
@ -87,7 +87,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Poll' $ref: '#/components/schemas/poll'
security: security:
- {} - {}
- pollAuth: [] - pollAuth: []
@ -99,7 +99,7 @@ paths:
schema: schema:
type: array type: array
items: items:
$ref: '#/components/schemas/Poll' $ref: '#/components/schemas/poll'
delete: delete:
operationId: delete-poll operationId: delete-poll
summary: Deletes a poll summary: Deletes a poll
@ -107,52 +107,9 @@ paths:
'200': '200':
description: OK description: OK
'404': '404':
$ref: '#/components/responses/PollNotFound' $ref: '#/components/responses/poll-not-found'
security: security:
- pollAuth: [] - pollAuth: []
'/polls/{poll-id}/judges':
parameters:
- in: path
name: poll-id
required: true
schema:
type: string
post:
operationId: add-judge-to-poll
description: Add a judge to a poll
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Judge'
responses:
'200':
description: Invitation was sent
content:
text/plain:
schema:
type: string
'404':
$ref: '#/components/responses/PollNotFound'
'/polls/{poll-id}/results':
parameters:
- in: path
name: poll-id
required: true
schema:
type: string
get:
operationId: get-poll-results
description: Get results of a poll
responses:
'200':
description: OK
content:
text/plain:
schema:
$ref: '#/components/schemas/Result'
'404':
$ref: '#/components/responses/PollNotFound'
'/polls/{poll-id}/judgments': '/polls/{poll-id}/judgments':
parameters: parameters:
- in: path - in: path
@ -161,14 +118,14 @@ paths:
schema: schema:
type: string type: string
post: post:
operationId: create-poll-judgment operationId: create-judgment
summary: Creates a judgment summary: Creates a judgment
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Judgment' $ref: '#/components/schemas/judgment'
security: security:
- {} - {}
- judgeAuth: [] - judgeAuth: []
@ -184,19 +141,24 @@ paths:
type: string type: string
description: Id of the created judgment. description: Id of the created judgment.
links: links:
GetJudgmentByJudgmentId: get-judgment:
$ref: '#/components/links/GetJudgmentByJudgmentId' $ref: '#/components/links/get-judgment'
DelJudgmentByJudgmentId: delete-judgment:
$ref: '#/components/links/DelJudgmentByJudgmentId' $ref: '#/components/links/delete-judgment'
'/judgments/{judgment-id}': '/polls/{poll-id}/judgments/{judgment-id}':
parameters: parameters:
- in: path
name: poll-id
required: true
schema:
type: string
- in: path - in: path
name: judgment-id name: judgment-id
required: true required: true
schema: schema:
type: string type: string
get: get:
operationId: get-poll-judgment operationId: get-judgment
summary: Gets a judgment by ID summary: Gets a judgment by ID
responses: responses:
'200': '200':
@ -204,17 +166,41 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Judgment' $ref: '#/components/schemas/judgment'
delete: delete:
operationId: delete-poll-judgment operationId: delete-judgment
summary: Deletes a judgment summary: Deletes a judgment
responses: responses:
'200': '200':
description: OK description: OK
'404': '404':
$ref: '#/components/responses/JudgmentNotFound' $ref: '#/components/responses/judgment-not-found'
security: security:
- judgeAuth: [] - judgeAuth: []
'/polls/{poll-id}/judges':
parameters:
- in: path
name: poll-id
required: true
schema:
type: string
post:
operationId: add-judge-to-poll
description: Add a judge to a poll
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/judge'
responses:
'200':
description: Invitation was sent
content:
text/plain:
schema:
type: string
'404':
$ref: '#/components/responses/poll-not-found'
'/polls/{poll-id}/judges/{judge-id}/': '/polls/{poll-id}/judges/{judge-id}/':
parameters: parameters:
- in: path - in: path
@ -231,9 +217,9 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Judge' $ref: '#/components/schemas/judge'
'404': '404':
$ref: '#/components/responses/JudgeNotFound' $ref: '#/components/responses/judge-not-found'
security: security:
- {} - {}
- pollAuth: [] - pollAuth: []
@ -244,9 +230,28 @@ paths:
'200': '200':
description: OK description: OK
'404': '404':
$ref: '#/components/responses/JudgeNotFound' $ref: '#/components/responses/judge-not-found'
security: security:
- pollAuth: [] - pollAuth: []
'/polls/{poll-id}/results':
parameters:
- in: path
name: poll-id
required: true
schema:
type: string
get:
operationId: get-poll-results
description: Get results of a poll
responses:
'200':
description: OK
content:
text/plain:
schema:
$ref: '#/components/schemas/result'
'404':
$ref: '#/components/responses/poll-not-found'
components: components:
securitySchemes: securitySchemes:
judgeAuth: judgeAuth:
@ -259,7 +264,7 @@ components:
type: http type: http
scheme: bearer scheme: bearer
schemas: schemas:
Judgment: judgment:
type: object type: object
properties: properties:
id: id:
@ -267,7 +272,7 @@ components:
readOnly: true readOnly: true
grade: grade:
type: string type: string
Candidate: candidate:
type: object type: object
properties: properties:
id: id:
@ -279,9 +284,9 @@ components:
judgments: judgments:
type: array type: array
items: items:
$ref: '#/components/schemas/Judgment' $ref: '#/components/schemas/judgment'
description: The judgments received by this candidate. description: The judgments received by this candidate.
Grade: grade:
type: object type: object
properties: properties:
id: id:
@ -290,7 +295,7 @@ components:
name: name:
type: string type: string
description: 'Unique but short name of the grade, like "Excellent" or "To reject".' description: 'Unique but short name of the grade, like "Excellent" or "To reject".'
Judge: judge:
type: object type: object
properties: properties:
id: id:
@ -305,7 +310,7 @@ components:
description: >- description: >-
Send a mail at the creation of the judge. The mail is not kept in Send a mail at the creation of the judge. The mail is not kept in
memory. memory.
Poll: poll:
type: object type: object
properties: properties:
id: id:
@ -319,22 +324,22 @@ components:
minItems: 2 minItems: 2
maxItems: 20 maxItems: 20
items: items:
$ref: '#/components/schemas/Candidate' $ref: '#/components/schemas/candidate'
description: The candidates being judged in a poll. description: The candidates being judged in a poll.
grades: grades:
type: array type: array
items: items:
$ref: '#/components/schemas/Grade' $ref: '#/components/schemas/grade'
description: The grades on which one judges a candidate. description: The grades on which one judges a candidate.
judges: judges:
type: array type: array
items: items:
$ref: '#/components/schemas/Judge' $ref: '#/components/schemas/judge'
description: The judges that are allowed to participate to the election. description: The judges that are allowed to participate to the election.
restrict_judges: restrict_judges:
type: boolean type: boolean
description: Can anyone create a judge? description: Can anyone create a judge?
Error: error:
type: object type: object
properties: properties:
code: code:
@ -344,82 +349,82 @@ components:
required: required:
- code - code
- message - message
Result: result:
type: object type: object
properties: properties:
poll: poll:
$ref: '#/components/schemas/Poll' $ref: '#/components/schemas/poll'
ranking: ranking:
type: array type: array
items: items:
type: integer type: integer
format: int16 format: int16
links: links:
GetPollByPollId: get-poll:
operationRef: get-poll operationRef: get-poll
parameters: parameters:
pollId: $response.body#/id pollId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `poll-id` The `id` value returned in the response can be used as the `poll-id`
parameter in GET /polls/{poll-id}. parameter in GET /polls/{poll-id}.
SetPollByPollId: update-poll:
operationRef: update-poll operationRef: update-poll
parameters: parameters:
pollId: $response.body#/id pollId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `poll-id` The `id` value returned in the response can be used as the `poll-id`
parameter in PATCH /polls/{poll-id}. parameter in PATCH /polls/{poll-id}.
DelPollByPollId: delete-poll:
operationRef: delete-poll operationRef: delete-poll
parameters: parameters:
pollId: $response.body#/id pollId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `poll-id` The `id` value returned in the response can be used as the `poll-id`
parameter in DELETE /polls/{poll-id}. parameter in DELETE /polls/{poll-id}.
JudgeByPollId: create-judgment:
operationRef: create-poll-judgment operationRef: create-judgment
parameters: parameters:
userId: $response.body#/id userId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `poll-id` The `id` value returned in the response can be used as the `poll-id`
parameter in GET /judgments/{poll-id}. parameter in POST /polls/{poll-id}/judgments.
ResultsByPollId: list-poll-results:
operationRef: get-poll-results operationRef: list-poll-results
parameters: parameters:
pollId: $response.body#/id pollId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `poll-id` The `id` value returned in the response can be used as the `poll-id`
parameter in GET /results/{result-id}. parameter in GET /polls/{poll-id}/results.
GetJudgmentByJudgmentId: get-judgment:
operationRef: get-judgment operationRef: get-judgment
parameters: parameters:
judgmentId: $response.body#/id judgmentId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `judgment-id` The `id` value returned in the response can be used as the `judgment-id`
parameter in GET /judgments/{judgment-id}. parameter in GET /polls/{poll-id}/judgments/{judgment-id}.
DelJudgmentByJudgmentId: delete-judgment:
operationId: delete-poll-judgment operationId: delete-judgment
parameters: parameters:
judgmentId: $response.body#/id judgmentId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `judgment-id` The `id` value returned in the response can be used as the `judgment-id`
parameter in DELETE /judgments/{judgment-id}. parameter in DELETE /polls/{poll-id}/judgments/{judgment-id}.
responses: responses:
PollNotFound: poll-not-found:
description: The specified poll was not found description: The specified poll was not found
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Error' $ref: '#/components/schemas/error'
JudgmentNotFound: judgment-not-found:
description: The specified judgment was not found description: The specified judgment was not found
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Error' $ref: '#/components/schemas/error'
JudgeNotFound: judge-not-found:
description: The specified judge was not found description: The specified judge was not found
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Error' $ref: '#/components/schemas/error'

@ -7,7 +7,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"start": "openapi preview-docs ./openapi/mv-openapi-root.yaml", "start": "openapi preview-docs ./openapi/mv-openapi-root.yaml",
"build": "openapi bundle --output ./mv-openapi.yaml ./openapi/mv-openapi-root.yaml", "build": "openapi bundle --output ./mv-openapi.yaml ./openapi/mv-openapi-root.yaml && sed -i '1s/^/# Warning: this file has been automatically generated. All manual modifications will be lost, see README.md for details.\\n/' ./mv-openapi.yaml",
"test": "openapi validate ./openapi/mv-openapi-root.yaml" "test": "openapi validate ./openapi/mv-openapi-root.yaml"
} }
} }

Loading…
Cancel
Save