Skip to content

Commit

Permalink
error messages aligned with the guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
monamok committed Mar 22, 2023
1 parent 18c6754 commit 1ef401a
Showing 1 changed file with 61 additions and 129 deletions.
190 changes: 61 additions & 129 deletions code/API_definitions/CAMARA/number_verification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ paths:
schema:
$ref: '#/components/schemas/NumberVerificationMatchResponse'
'400':
$ref: '#/components/responses/InvalidArgument'
$ref: '#/components/responses/Generic400'
'401':
$ref: '#/components/responses/Unauthenticated'
$ref: '#/components/responses/Generic401'
'403':
$ref: '#/components/responses/PhoneNumberVerificationPermissionDenied'
$ref: '#/components/responses/PhoneNumberVerificationPermissionDenied403'
'500':
$ref: '#/components/responses/Internal'
$ref: '#/components/responses/Generic500'
'503':
$ref: '#/components/responses/Unavailable'
$ref: '#/components/responses/Generic503'
'504':
$ref: '#/components/responses/Timeout'
$ref: '#/components/responses/Generic504'
security:
- three_legged:
- number-verification-verify-read
Expand Down Expand Up @@ -118,17 +118,17 @@ paths:
schema:
$ref: '#/components/schemas/NumberVerificationShareResponse'
'400':
$ref: '#/components/responses/InvalidArgument'
$ref: '#/components/responses/Generic400'
'401':
$ref: '#/components/responses/Unauthenticated'
$ref: '#/components/responses/Generic401'
'403':
$ref: '#/components/responses/PhoneNumberVerificationPermissionDenied'
$ref: '#/components/responses/PhoneNumberVerificationPermissionDenied403'
'500':
$ref: '#/components/responses/Internal'
$ref: '#/components/responses/Generic500'
'503':
$ref: '#/components/responses/Unavailable'
$ref: '#/components/responses/Generic503'
'504':
$ref: '#/components/responses/Timeout'
$ref: '#/components/responses/Generic504'
security:
- three_legged:
- number-verification-share-read
Expand Down Expand Up @@ -181,37 +181,24 @@ components:
DevicePhoneNumberVerified:
description: Number verification. True, if it matches
type: boolean
ModelError:
ErrorInfo:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
minimum: 400
maximum: 599
description: HTTP response status code
code:
type: string
description: Code given to this error
message:
type: string
description: A human readable description of what the event represent
PhoneNumberVerificationPermissionDenied:
allOf:
- type: object
required:
- code
properties:
code:
type: string
enum:
- PERMISSION_DENIED
- NUMBER_VERIFICATION.USER_NOT_AUTHENTICATED_BY_MOBILE_NETWORK
- NUMBER_VERIFICATION.INVALID_TOKEN_CONTEXT
default: PERMISSION_DENIED
description: Client does not have sufficient permissions to perform this action.
- $ref: '#/components/schemas/ModelError'
description: Detailed error description
responses:
InvalidArgument:
Generic400:
description: Problem with the client request
headers:
x-correlator:
Expand All @@ -221,25 +208,12 @@ components:
content:
application/json:
schema:
allOf:
- type: object
required:
- code
properties:
code:
type: string
enum:
- INVALID_ARGUMENT
default: INVALID_ARGUMENT
description: Client specified an invalid argument, request body or query param.
- $ref: '#/components/schemas/ModelError'
examples:
response:
value:
status: 400
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query param
Unauthenticated:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 400
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query param
Generic401:
description: Authentication problem with the client request
headers:
x-correlator:
Expand All @@ -249,25 +223,12 @@ components:
content:
application/json:
schema:
allOf:
- type: object
required:
- code
properties:
code:
type: string
enum:
- UNAUTHENTICATED
default: UNAUTHENTICATED
description: Request not authenticated due to missing, invalid, or expired credentials.
- $ref: '#/components/schemas/ModelError'
examples:
response:
value:
status: 401
code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or expired credentials
PhoneNumberVerificationPermissionDenied:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 401
code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or expired credentials
PhoneNumberVerificationPermissionDenied403:
description: |-
Client does not have sufficient permission.
In addition to regular scenario of `PERMISSION_DENIED`, other scenarios may exist:
Expand All @@ -281,14 +242,24 @@ components:
content:
application/json:
schema:
$ref: '#/components/schemas/PhoneNumberVerificationPermissionDenied'
$ref: "#/components/schemas/ErrorInfo"
examples:
response:
PermissionDenied:
value:
status: 403
code: PERMISSION_DENIED
message: Client does not have sufficient permissions to perform this action
PhoneNumberVerificationPermissionDenied:
value:
status: 403
code: NUMBER_VERIFICATION.USER_NOT_AUTHENTICATED_BY_MOBILE_NETWORK
message: Client must authenticate via the mobile network to use this service
Internal:
InvalidTokenContext:
value:
status: 403
code: HOME_DEVICES_QOD.INVALID_TOKEN_CONTEXT
message: Phone number cannot be deducted from access token context
Generic500:
description: Server error
headers:
x-correlator:
Expand All @@ -298,25 +269,12 @@ components:
content:
application/json:
schema:
allOf:
- type: object
required:
- code
properties:
code:
type: string
enum:
- INTERNAL
default: INTERNAL
description: Unknown server error.Typically a server bug.
- $ref: '#/components/schemas/ModelError'
examples:
response:
value:
status: 500
code: INTERNAL
message: Server error
Unavailable:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 500
code: INTERNAL
message: Server error
Generic503:
description: Service unavailable. Typically the server is down.
headers:
x-correlator:
Expand All @@ -326,25 +284,12 @@ components:
content:
application/json:
schema:
allOf:
- type: object
required:
- code
properties:
code:
type: string
enum:
- UNAVAILABLE
default: UNAVAILABLE
description: Request timeout exceeded
- $ref: '#/components/schemas/ModelError'
examples:
response:
value:
status: 503
code: UNAVAILABLE
message: Service unavailable
Timeout:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 503
code: UNAVAILABLE
message: Service unavailable
Generic504:
description: Request time exceeded. If it happens repeatedly, consider reducing the request complexity
headers:
x-correlator:
Expand All @@ -354,24 +299,11 @@ components:
content:
application/json:
schema:
allOf:
- type: object
required:
- code
properties:
code:
type: string
enum:
- TIMEOUT
default: TIMEOUT
description: Request timeout exceeded
- $ref: '#/components/schemas/ModelError'
examples:
response:
value:
status: 504
code: TIMEOUT
message: Request timeout exceeded. Try later.
$ref: "#/components/schemas/ErrorInfo"
example:
status: 504
code: TIMEOUT
message: Request timeout exceeded. Try later.
externalDocs:
description: Project documentation at CAMARA
url: https://github.com/camaraproject/NumberVerification

0 comments on commit 1ef401a

Please sign in to comment.