feature #11: describe "constitutions routes" in openAPI
This commit is contained in:
@@ -133,6 +133,67 @@ paths:
|
|||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/ArticleResponse'
|
$ref: '#/components/schemas/ArticleResponse'
|
||||||
|
|
||||||
|
/constitutions:
|
||||||
|
get:
|
||||||
|
summary: Get all constitutions
|
||||||
|
tags:
|
||||||
|
- constitution
|
||||||
|
operationId: getConstitutions
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/page'
|
||||||
|
- $ref: '#/components/parameters/limit'
|
||||||
|
- $ref: '#/components/parameters/sort'
|
||||||
|
- $ref: '#/components/parameters/direction'
|
||||||
|
- $ref: '#/components/parameters/search'
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The Constitution objects
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/ConstitutionResponse'
|
||||||
|
post:
|
||||||
|
summary: Create new Constitution
|
||||||
|
tags:
|
||||||
|
- constitution
|
||||||
|
operationId: insertConstitution
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ConstitutionRequest'
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
description: Constitution created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ConstitutionResponse'
|
||||||
|
/constitutions/{constitution}:
|
||||||
|
get:
|
||||||
|
summary: Get all constitutions
|
||||||
|
tags:
|
||||||
|
- constitution
|
||||||
|
operationId: getConstitutions
|
||||||
|
parameters:
|
||||||
|
- name: constitution
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
description: the ID of constitution
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The Constitution objects
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ConstitutionResponse'
|
||||||
|
|
||||||
components:
|
components:
|
||||||
parameters:
|
parameters:
|
||||||
page:
|
page:
|
||||||
@@ -214,6 +275,11 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
format: 'date-time'
|
format: 'date-time'
|
||||||
|
|
||||||
|
versionId:
|
||||||
|
properties:
|
||||||
|
version_id:
|
||||||
|
$ref: '#/components/schemas/UUID'
|
||||||
|
|
||||||
UserBase:
|
UserBase:
|
||||||
properties:
|
properties:
|
||||||
username:
|
username:
|
||||||
@@ -294,6 +360,8 @@ components:
|
|||||||
|
|
||||||
ArticleBase:
|
ArticleBase:
|
||||||
type: object
|
type: object
|
||||||
|
allOf:
|
||||||
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
title:
|
title:
|
||||||
type: string
|
type: string
|
||||||
@@ -314,6 +382,7 @@ components:
|
|||||||
type: boolean
|
type: boolean
|
||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
|
- $ref: '#/components/schemas/versionId'
|
||||||
ArticleResponse:
|
ArticleResponse:
|
||||||
type: object
|
type: object
|
||||||
allOf:
|
allOf:
|
||||||
@@ -324,6 +393,89 @@ components:
|
|||||||
ArticleRequest:
|
ArticleRequest:
|
||||||
$ref: '#/components/schemas/ArticleBase'
|
$ref: '#/components/schemas/ArticleBase'
|
||||||
|
|
||||||
|
ConstitutionBase:
|
||||||
|
type: object
|
||||||
|
allOf:
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
example:
|
||||||
|
Constitution for the liberty
|
||||||
|
titles:
|
||||||
|
type: array
|
||||||
|
required: false
|
||||||
|
default: []
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/TitleBase'
|
||||||
|
annonymous:
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
- $ref: '#/components/schemas/versionId'
|
||||||
|
ConstitutionResponse:
|
||||||
|
type: object
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/ConstitutionBase'
|
||||||
|
- $ref: '#/components/schemas/UuidEntity'
|
||||||
|
- $ref: '#/components/schemas/CreatedBy'
|
||||||
|
- $ref: '#/components/schemas/CreatedAt'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
titles:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/TitleResponse'
|
||||||
|
ConstitutionRequest:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/ConstitutionBase'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
titles:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/TitleRequest'
|
||||||
|
|
||||||
|
TitleBase:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
example:
|
||||||
|
The liberties
|
||||||
|
rank:
|
||||||
|
type: integer
|
||||||
|
minimum: 0
|
||||||
|
example:
|
||||||
|
0
|
||||||
|
TitleRequest:
|
||||||
|
type: object
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TitleBase'
|
||||||
|
- $ref: '#/components/schemas/UuidEntity'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
articles:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UuidEntity'
|
||||||
|
TitleResponse:
|
||||||
|
type: object
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/TitleBase'
|
||||||
|
- $ref: '#/components/schemas/UuidEntity'
|
||||||
|
- $ref: '#/components/schemas/CreatedAt'
|
||||||
|
- $ref: '#/components/schemas/CreatedBy'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
articles:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/ArticleBase'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
requestBodies:
|
requestBodies:
|
||||||
RegisterRequest:
|
RegisterRequest:
|
||||||
|
|||||||
Reference in New Issue
Block a user