From 20e9c3f7efb0c7b57f496485691b9eb0ca4a82ac Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Thu, 29 Aug 2019 14:11:08 +0200 Subject: [PATCH] Refactor openApi parameters --- src/main/resources/openApi.yaml | 118 ++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 51 deletions(-) diff --git a/src/main/resources/openApi.yaml b/src/main/resources/openApi.yaml index 616773d..3876cfb 100644 --- a/src/main/resources/openApi.yaml +++ b/src/main/resources/openApi.yaml @@ -65,7 +65,6 @@ paths: 404: description: Citizen not found /citizens: - description: Get all citizens get: security: - JWTAuth: [] @@ -74,60 +73,72 @@ paths: - citizen operationId: getCitizens parameters: - - name: page - in: query - description: The current page - example: 1 - required: false - schema: - default: 1 - type: integer - minimum: 1 - - name: limit - in: query - description: The number of citizen per page - example: 50 - required: false - schema: - default: 50 - type: integer - minimum: 1 - maximum: 50 - - name: sort - in: query - description: The sort field name - example: first_name - required: false - schema: - type: string - - name: direction - in: query - description: The sort direction - example: asc - required: false - schema: - type: string - default: asc - enum: [asc, desc] - - name: search - in: query - description: A text to seach - example: John Doe - required: false - schema: - type: string + - $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 object + description: The Citizen objects content: application/json: schema: - $ref: '#/components/schemas/CitizenResponse' - 404: - description: Citizen not found + type: array + items: + $ref: '#/components/schemas/CitizenResponse' components: + parameters: + page: + name: page + in: query + description: The current page + example: 1 + required: false + schema: + default: 1 + type: integer + minimum: 1 + limit: + name: limit + in: query + description: The number of object per page + example: 50 + required: false + schema: + default: 50 + type: integer + minimum: 1 + maximum: 50 + sort: + name: sort + in: query + description: The sort field name + example: first_name + required: false + schema: + type: string + direction: + name: direction + in: query + description: The sort direction + example: asc + required: false + schema: + type: string + default: asc + enum: [asc, desc] + search: + name: search + in: query + description: A text to seach + example: John Doe + required: false + schema: + type: string + 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'