diff --git a/src/main/resources/openapi2.yaml b/src/main/resources/openapi2.yaml index 6684854..beb4889 100644 --- a/src/main/resources/openapi2.yaml +++ b/src/main/resources/openapi2.yaml @@ -310,7 +310,6 @@ paths: example: azerty format: password - responses: 200: description: User created and JWT returned @@ -331,6 +330,37 @@ paths: application/json: schema: description: sdf + /auth/passwordless: + post: + summary: Send a connexion link by email + description: Send a connexion link by email with the token required to the connexion + externalDocs: + description: Explanation of Passwordless auth + url: https://en.wikipedia.org/wiki/Passwordless_authentication + tags: + - authentification + operationId: passwordless + requestBody: + content: + application/json: + schema: + properties: + email: + type: string + format: email + description: email to send the token + example: + my.email@dc-project.fr + url: + type: string + description: url tu redirect with the token + example: + http://dc-project.fr/auth/passwordless + responses: + 204: + description: email send + 404: + description: no user with this email components: parameters: diff --git a/src/test/kotlin/integration/steps/then/schema.kt b/src/test/kotlin/integration/steps/then/schema.kt index 81aa75a..0168321 100644 --- a/src/test/kotlin/integration/steps/then/schema.kt +++ b/src/test/kotlin/integration/steps/then/schema.kt @@ -59,11 +59,13 @@ fun TestApplicationResponse.`And the schema response body must be valid`(content ObjectMapper().readTree(content) else TextNode("") - getResponse(status?.value?.toString() ?: error("HttpStatus not found")) - ?.getContentMediaType(contentType.toString()) - ?.schema - ?.validate(api, responseContent) - ?: fail("""No Status "${status.value}" found with media type "$contentType" for "$this $uri".""") + val response = getResponse(status?.value?.toString() ?: error("HttpStatus not found")) ?: fail("""No Status "${status.value}" found for "$this $uri".""") + val schema = response.getContentMediaType(contentType.toString())?.schema + + if (content != null) { + schema?.validate(api, responseContent) + ?: fail("""No Status "${status.value}" found with media type "$contentType" for "$this $uri".""") + } } } }