Replace the hand-written mvapi.yml by its auto-generated equivalent.

pull/13/head
Nathanaël Jourdane 4 years ago committed by guhur
parent acf4d0bb48
commit 37d115dc89

3
.gitignore vendored

@ -1,3 +1,2 @@
# Dir for bundles # Node modules directory
dist
node_modules node_modules

@ -1,18 +1,17 @@
openapi: 3.0.0 openapi: 3.0.0
info: info:
title: Mieux Voter title: Mieux Voter
description: >- description: A poll application based on Majority Judgment (MJ).
An Application Programming Interface (API) for Majority Judgment (MJ) version: 1.0.1-oas3
Polling.
version: "1.0.1-oas3"
termsOfService: 'https://github.com/MieuxVoter' termsOfService: 'https://github.com/MieuxVoter'
contact: contact:
name: Mieux Voter app developpers team
email: app@mieuxvoter.fr email: app@mieuxvoter.fr
servers: servers:
- url: 'https://api.mieuxvoter.fr/v1' - url: 'https://api.mieuxvoter.fr/v1'
description: 'Main (production) server' description: Main (production) server
- url: 'https://sandboxapi.mieuxvoter.fr/v1' - url: 'https://sandboxapi.mieuxvoter.fr/v1'
description: 'Internal staging server for testing' description: Internal staging server for testing
paths: paths:
/polls: /polls:
get: get:
@ -76,7 +75,7 @@ paths:
schema: schema:
$ref: '#/components/schemas/Poll' $ref: '#/components/schemas/Poll'
'404': '404':
$ref: '#/components/responses/PollNotFound' $ref: '#/components/responses/PollNotFound'
patch: patch:
summary: Updates a poll summary: Updates a poll
requestBody: requestBody:
@ -103,7 +102,7 @@ paths:
'200': '200':
description: OK description: OK
'404': '404':
$ref: '#/components/responses/PollNotFound' $ref: '#/components/responses/PollNotFound'
security: security:
- pollAuth: [] - pollAuth: []
'/polls/{poll-id}/judges': '/polls/{poll-id}/judges':
@ -113,7 +112,7 @@ paths:
required: true required: true
schema: schema:
type: string type: string
post: post:
description: Add a judge to a poll description: Add a judge to a poll
requestBody: requestBody:
content: content:
@ -208,12 +207,12 @@ paths:
- judgeAuth: [] - judgeAuth: []
'/polls/{poll-id}/judges/{judge-id}/': '/polls/{poll-id}/judges/{judge-id}/':
parameters: parameters:
- in: path - in: path
name: judge-id name: judge-id
required: true required: true
schema: schema:
type: string type: string
get: get:
summary: Get a judge from a poll summary: Get a judge from a poll
responses: responses:
'200': '200':
@ -227,7 +226,7 @@ paths:
security: security:
- {} - {}
- pollAuth: [] - pollAuth: []
delete: delete:
summary: Delete a judge from a poll summary: Delete a judge from a poll
responses: responses:
'200': '200':
@ -237,76 +236,63 @@ paths:
security: security:
- pollAuth: [] - pollAuth: []
components: components:
responses: securitySchemes:
PollNotFound: judgeAuth:
description: The specified poll was not found type: http
content: scheme: bearer
application/json: pollAuth:
schema: type: http
$ref: '#/components/schemas/Error' scheme: bearer
JudgeNotFound: resultAuth:
description: The specified judge was not found type: http
content: scheme: bearer
application/json:
schema:
$ref: '#/components/schemas/Error'
JudgmentNotFound:
description: The specified judgment was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas: schemas:
Grade: Judgment:
type: object type: object
properties: properties:
id: id:
type: string type: string
readOnly: true readOnly: true
name: grade:
type: string type: string
description: Unique but short name of the grade, like "Excellent" or "To reject". Candidate:
Judge:
type: object type: object
properties: properties:
id: id:
type: string type: string
readOnly: true readOnly: true
has-voted: name:
type: string
poll-id:
type: string type: string
mail: description: Unique but short name of the candidate.
type: object judgments:
description: Send a mail at the creation of the judge. The mail is not kept in memory. type: array
Judgment: items:
$ref: '#/components/schemas/Judgment'
description: The judgments received by this candidate.
Grade:
type: object type: object
properties: properties:
id: id:
type: string type: string
readOnly: true readOnly: true
grade: name:
type: string type: string
Candidate: description: 'Unique but short name of the grade, like "Excellent" or "To reject".'
Judge:
type: object type: object
properties: properties:
id: id:
type: string type: string
readOnly: true readOnly: true
name: has-voted:
type: string type: string
description: Unique but short name of the candidate. poll-id:
judgments: type: string
type: array mail:
items: type: object
$ref: '#/components/schemas/Judgment' description: >-
description: The judgments received by this candidate. Send a mail at the creation of the judge. The mail is not kept in
memory.
Poll: Poll:
type: object type: object
properties: properties:
@ -336,16 +322,6 @@ components:
restrict_judges: restrict_judges:
type: boolean type: boolean
description: Can anyone create a judge? description: Can anyone create a judge?
Result:
type: object
properties:
poll:
$ref: '#/components/schemas/Poll'
ranking:
type: array
items:
type: integer
format: int16
Error: Error:
type: object type: object
properties: properties:
@ -356,62 +332,82 @@ components:
required: required:
- code - code
- message - message
securitySchemes: Result:
judgeAuth: type: object
type: http properties:
scheme: bearer poll:
pollAuth: $ref: '#/components/schemas/Poll'
type: http ranking:
scheme: bearer type: array
resultAuth: items:
type: http type: integer
scheme: bearer format: int16
links: links:
ResultsByPollId:
operationRef: '#/paths/~1polls/~1{poll-id}/results/get'
parameters:
pollId: '$response.body#/id'
description: >
The `id` value returned in the response can be used as the `poll-id` parameter in GET /results/{result-id}.
GetPollByPollId: GetPollByPollId:
operationRef: '#/paths/~1polls/~1{poll-id}/get' operationRef: '#/paths/~1polls/~1{poll-id}/get'
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` parameter in GET /polls/{poll-id}. The `id` value returned in the response can be used as the `poll-id`
parameter in GET /polls/{poll-id}.
SetPollByPollId: SetPollByPollId:
operationRef: '#/paths/~1polls/~1{poll-id}/patch' operationRef: '#/paths/~1polls/~1{poll-id}/patch'
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` parameter in PATCH /polls/{poll-id}. The `id` value returned in the response can be used as the `poll-id`
parameter in PATCH /polls/{poll-id}.
DelPollByPollId: DelPollByPollId:
operationRef: '#/paths/~1polls/~1{poll-id}/delete' operationRef: '#/paths/~1polls/~1{poll-id}/delete'
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` parameter in DELETE /polls/{poll-id}. The `id` value returned in the response can be used as the `poll-id`
GetJudgmentByJudgmentId: parameter in DELETE /polls/{poll-id}.
operationRef: '#/paths/~1judgments/~1{judgment-id}/get' JudgeByPollId:
operationRef: '#/paths/~1judges/~1{poll-id}/post'
parameters: parameters:
judgmentId: '$response.body#/id' userId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `judgment-id` parameter in GET /judgments/{judgment-id}. The `id` value returned in the response can be used as the `poll-id`
DelJudgmentByJudgmentId: parameter in GET /judgments/{poll-id}.
operationRef: '#/paths/~1judgments/~1{judgment-id}/delete' ResultsByPollId:
operationRef: '#/paths/~1polls/~1{poll-id}/results/get'
parameters: parameters:
judgmentId: '$response.body#/id' pollId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `judgment-id` parameter in DELETE /judgments/{judgment-id}. The `id` value returned in the response can be used as the `poll-id`
JudgeByPollId: parameter in GET /results/{result-id}.
operationRef: '#/paths/~1judges/~1{poll-id}/post' GetJudgmentByJudgmentId:
operationRef: '#/paths/~1judgments/~1{judgment-id}/get'
parameters: parameters:
userId: '$response.body#/id' judgmentId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `poll-id` parameter in GET /judgments/{poll-id}. The `id` value returned in the response can be used as the `judgment-id`
InviteByPollId: parameter in GET /judgments/{judgment-id}.
operationRef: '#/paths/~1polls/~1{poll-id}/judges/post' DelJudgmentByJudgmentId:
operationRef: '#/paths/~1judgments/~1{judgment-id}/delete'
parameters: parameters:
userId: '$response.body#/id' judgmentId: $response.body#/id
description: > description: >
The `id` value returned in the response can be used as the `poll-id` parameter in GET /invites/{poll-id}. The `id` value returned in the response can be used as the `judgment-id`
parameter in DELETE /judgments/{judgment-id}.
responses:
PollNotFound:
description: The specified poll was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
JudgmentNotFound:
description: The specified judgment was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
JudgeNotFound:
description: The specified judge was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

@ -7,7 +7,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"start": "openapi preview-docs", "start": "openapi preview-docs",
"build": "openapi bundle -o dist", "build": "openapi bundle --output ./mv-openapi.yaml",
"test": "openapi validate" "test": "openapi validate"
} }
} }

Loading…
Cancel
Save