Refactor openApi parameters
This commit is contained in:
@@ -65,7 +65,6 @@ paths:
|
||||
404:
|
||||
description: Citizen not found
|
||||
/citizens:
|
||||
description: Get all citizens
|
||||
get:
|
||||
security:
|
||||
- JWTAuth: []
|
||||
@@ -74,7 +73,26 @@ paths:
|
||||
- citizen
|
||||
operationId: getCitizens
|
||||
parameters:
|
||||
- name: page
|
||||
- $ref: '#/components/parameters/page'
|
||||
- $ref: '#/components/parameters/limit'
|
||||
- $ref: '#/components/parameters/sort'
|
||||
- $ref: '#/components/parameters/direction'
|
||||
- $ref: '#/components/parameters/search'
|
||||
responses:
|
||||
200:
|
||||
description: The Citizen objects
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/CitizenResponse'
|
||||
|
||||
|
||||
components:
|
||||
parameters:
|
||||
page:
|
||||
name: page
|
||||
in: query
|
||||
description: The current page
|
||||
example: 1
|
||||
@@ -83,9 +101,10 @@ paths:
|
||||
default: 1
|
||||
type: integer
|
||||
minimum: 1
|
||||
- name: limit
|
||||
limit:
|
||||
name: limit
|
||||
in: query
|
||||
description: The number of citizen per page
|
||||
description: The number of object per page
|
||||
example: 50
|
||||
required: false
|
||||
schema:
|
||||
@@ -93,14 +112,16 @@ paths:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 50
|
||||
- name: sort
|
||||
sort:
|
||||
name: sort
|
||||
in: query
|
||||
description: The sort field name
|
||||
example: first_name
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: direction
|
||||
direction:
|
||||
name: direction
|
||||
in: query
|
||||
description: The sort direction
|
||||
example: asc
|
||||
@@ -109,25 +130,15 @@ paths:
|
||||
type: string
|
||||
default: asc
|
||||
enum: [asc, desc]
|
||||
- name: search
|
||||
search:
|
||||
name: search
|
||||
in: query
|
||||
description: A text to seach
|
||||
example: John Doe
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: The Citizen object
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CitizenResponse'
|
||||
404:
|
||||
description: Citizen not found
|
||||
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
JWTAuth:
|
||||
type: http
|
||||
@@ -143,6 +154,14 @@ components:
|
||||
example:
|
||||
e74be8e4-6823-47c4-bd1b-789725b2fa8e
|
||||
|
||||
UuidEntity:
|
||||
properties:
|
||||
id:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
$ref: '#/components/schemas/UUID'
|
||||
|
||||
UserBase:
|
||||
properties:
|
||||
username:
|
||||
@@ -153,10 +172,7 @@ components:
|
||||
UserResponse:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/UserBase'
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
$ref: '#/components/schemas/UUID'
|
||||
- $ref: '#/components/schemas/UuidEntity'
|
||||
UserRequest:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/UserBase'
|
||||
|
||||
Reference in New Issue
Block a user