@ -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/ P oll'
$ref : '#/components/schemas/ p oll'
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/ P oll'
$ref : '#/components/schemas/ p oll'
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/ P oll'
$ref : '#/components/schemas/ p oll'
'404' :
'404' :
$ref : '#/components/responses/ PollNotF ound'
$ref : '#/components/responses/ poll-not-f ound'
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/ P oll'
$ref : '#/components/schemas/ p oll'
security:
security:
- {}
- {}
- pollAuth : [ ]
- pollAuth : [ ]
@ -99,7 +99,7 @@ paths:
schema:
schema:
type : array
type : array
items:
items:
$ref : '#/components/schemas/ P oll'
$ref : '#/components/schemas/ p oll'
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/ PollNotF ound'
$ref : '#/components/responses/ poll-not-f ound'
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/ J udgment'
$ref : '#/components/schemas/ j udgment'
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/ J udgment'
$ref : '#/components/schemas/ j udgment'
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/ JudgmentNotF ound'
$ref : '#/components/responses/ judgment-not-f ound'
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/ J udge'
$ref : '#/components/schemas/ j udge'
'404' :
'404' :
$ref : '#/components/responses/ JudgeNotF ound'
$ref : '#/components/responses/ judge-not-f ound'
security:
security:
- {}
- {}
- pollAuth : [ ]
- pollAuth : [ ]
@ -244,9 +230,28 @@ paths:
'200' :
'200' :
description : OK
description : OK
'404' :
'404' :
$ref : '#/components/responses/ JudgeNotF ound'
$ref : '#/components/responses/ judge-not-f ound'
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:
J udgment:
j udgment:
type : object
type : object
properties:
properties:
id:
id:
@ -267,7 +272,7 @@ components:
readOnly : true
readOnly : true
grade:
grade:
type : string
type : string
C andidate:
c andidate:
type : object
type : object
properties:
properties:
id:
id:
@ -279,9 +284,9 @@ components:
judgments:
judgments:
type : array
type : array
items:
items:
$ref : '#/components/schemas/ J udgment'
$ref : '#/components/schemas/ j udgment'
description : The judgments received by this candidate.
description : The judgments received by this candidate.
G rade:
g rade:
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".'
J udge:
j udge:
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.
P oll:
p oll:
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/ C andidate'
$ref : '#/components/schemas/ c andidate'
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/ G rade'
$ref : '#/components/schemas/ g rade'
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/ J udge'
$ref : '#/components/schemas/ j udge'
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?
E rror:
e rror:
type : object
type : object
properties:
properties:
code:
code:
@ -344,82 +349,82 @@ components:
required:
required:
- code
- code
- message
- message
R esult:
r esult:
type : object
type : object
properties:
properties:
poll:
poll:
$ref : '#/components/schemas/ P oll'
$ref : '#/components/schemas/ p oll'
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 : ge t-poll-results
operationRef : lis t-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:
PollNotF ound:
poll-not-f ound:
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/ E rror'
$ref : '#/components/schemas/ e rror'
JudgmentNotF ound:
judgment-not-f ound:
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/ E rror'
$ref : '#/components/schemas/ e rror'
JudgeNotF ound:
judge-not-f ound:
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/ E rror'
$ref : '#/components/schemas/ e rror'