Skip to content

Commit

Permalink
Merge pull request #128 from fernandopradocabrillo/update-yaml-pr-123
Browse files Browse the repository at this point in the history
Update error examples and add reference for x-correlator
  • Loading branch information
hdamker authored Jul 31, 2024
2 parents db4e912 + 6d23f05 commit ab0576c
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions code/API_definitions/number_verification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ components:
openId:
type: openIdConnect
openIdConnectUrl: https://example.com/.well-known/openid-configuration
headers:
x-correlator:
description: Correlation id for the different services
schema:
type: string
schemas:
NumberVerificationRequestBody:
type: object
Expand Down Expand Up @@ -228,10 +233,8 @@ components:
Generic400:
description: Problem with the client request
headers:
X-Correlator:
description: Correlation id for the different services
schema:
type: string
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
Expand All @@ -241,58 +244,62 @@ components:
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query param
Generic401:
description: Authentication problem with the client request
description: Unauthorized
headers:
X-Correlator:
description: Correlation id for the different services
schema:
type: string
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
example:
status: 401
code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or expired credentials
examples:
GENERIC_401_UNAUTHENTICATED:
description: Request cannot be authenticated
value:
status: 401
code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or expired credentials.
GENERIC_401_AUTHENTICATION_REQUIRED:
description: New authentication is needed, authentication is no longer valid
value:
status: 401
code: AUTHENTICATION_REQUIRED
message: New authentication is required.
PhoneNumberVerificationPermissionDenied403:
description: |
Client does not have sufficient permission.
In addition to regular scenario of `PERMISSION_DENIED`, other scenarios may exist:
- Client authentication was not via mobile network. In order to check the authentication method, AMR parameter value in the 3-legged user's access token can be used and make sure that the authentication was not either by SMS+OTP nor username/password (`{"code": "NUMBER_VERIFICATION.USER_NOT_AUTHENTICATED_BY_MOBILE_NETWORK","message": "Client must authenticate via the mobile network to use this service"}`)
- Phone number cannot be deducted from access token context.(`{"code": "NUMBER_VERIFICATION.INVALID_TOKEN_CONTEXT","message": "Phone number cannot be deducted from access token context"}`)
headers:
X-Correlator:
description: Correlation id for the different services
schema:
type: string
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInfo'
examples:
PermissionDenied:
GENERIC_403_PERMISSION_DENIED:
description: Permission denied. OAuth2 token access does not have the required scope or when the user fails operational security
value:
status: 403
code: PERMISSION_DENIED
message: Client does not have sufficient permissions to perform this action
UserNotAuthenticatedByMobileNetwork:
message: Client does not have sufficient permissions to perform this action.
GENERIC_403_USER_NOT_AUTHENTICATED_BY_MOBILE_NETWORK:
value:
status: 403
code: NUMBER_VERIFICATION.USER_NOT_AUTHENTICATED_BY_MOBILE_NETWORK
message: Client must authenticate via the mobile network to use this service
InvalidTokenContext:
GENERIC_403_INVALID_TOKEN_CONTEXT:
value:
status: 403
code: NUMBER_VERIFICATION.INVALID_TOKEN_CONTEXT
code: INVALID_TOKEN_CONTEXT
message: Phone number cannot be deducted from access token context
Generic500:
description: Server error
headers:
X-Correlator:
description: Correlation id for the different services
schema:
type: string
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
Expand All @@ -304,10 +311,8 @@ components:
Generic503:
description: Service unavailable. Typically the server is down.
headers:
X-Correlator:
description: Correlation id for the different services
schema:
type: string
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
Expand All @@ -319,10 +324,8 @@ components:
Generic504:
description: Request time exceeded. If it happens repeatedly, consider reducing the request complexity
headers:
X-Correlator:
description: Correlation id for the different services
schema:
type: string
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
Expand Down

0 comments on commit ab0576c

Please sign in to comment.