From c057a4aad3cd64f8507816601af801a70f2147e7 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Thu, 29 Aug 2019 02:22:31 +0200 Subject: [PATCH] feature #11: describe login in openAPI --- src/main/resources/openApi.yaml | 47 ++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/src/main/resources/openApi.yaml b/src/main/resources/openApi.yaml index 7d07b51..0521d69 100644 --- a/src/main/resources/openApi.yaml +++ b/src/main/resources/openApi.yaml @@ -13,7 +13,7 @@ paths: post: summary: Create account tags: - - login + - authentification operationId: register requestBody: $ref: '#/components/requestBodies/RegisterRequest' @@ -26,6 +26,22 @@ paths: example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBdXRoZW50aWNhdGlvbiIsImlzcyI6ImRjLXByb2plY3QuZnIiLCJpZCI6ImQ1NDRhNmE4LWJhYjgtNDU2MC05NWIxLThhZjAyMDNkOTEwNCIsImV4cCI6MTU2NzA3Mzc0Mn0.0VTetv8fZFjVgpJ-bwJpidGNHJUOmgj8vuZcZXzwnLa7TtFwcXWvh3bDPYHqB66nmOfXyM57XnHDbmRwtipCag + /login: + post: + summary: sign in + tags: + - authentification + operationId: login + requestBody: + $ref: '#/components/requestBodies/LoginRequest' + responses: + 200: + description: return JWT + content: + text/plain: + example: + eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBdXRoZW50aWNhdGlvbiIsImlzcyI6ImRjLXByb2plY3QuZnIiLCJpZCI6ImQ1NDRhNmE4LWJhYjgtNDU2MC05NWIxLThhZjAyMDNkOTEwNCIsImV4cCI6MTU2NzA3Mzc0Mn0.0VTetv8fZFjVgpJ-bwJpidGNHJUOmgj8vuZcZXzwnLa7TtFwcXWvh3bDPYHqB66nmOfXyM57XnHDbmRwtipCag + components: schemas: UUID: @@ -61,7 +77,7 @@ components: example: azerty - CitizenRespose: + CitizenResponse: allOf: - $ref: '#/components/schemas/CitizenBase' - type: object @@ -70,7 +86,6 @@ components: $ref: '#/components/schemas/UUID' user: $ref: '#/components/schemas/UserResponse' - CitizenBase: type: object properties: @@ -102,6 +117,21 @@ components: RegisterRequest: $ref: '#/components/schemas/CitizenRequest' + LoginRequest: + properties: + name: + type: string + description: username + required: true + example: + john-doe + password: + type: string + description: Pasword + required: true + example: + azerty + requestBodies: RegisterRequest: content: @@ -114,6 +144,17 @@ components: description: Register required: true + LoginRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/LoginRequest' + application/xml: + schema: + $ref: '#/components/schemas/LoginRequest' + description: Login + required: true + # Added by API Auto Mocking Plugin servers: - description: localhost