Skip to content

Commit

Permalink
Merge pull request #193 from maxl2287/feature/align-guideline-error-s…
Browse files Browse the repository at this point in the history
…cenarios

Subscription-APIs: Alignment of errors with Commonalities
  • Loading branch information
akoshunyadi authored Jul 25, 2024
2 parents 1c7b905 + 0c148e5 commit f089994
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 127 deletions.
142 changes: 79 additions & 63 deletions code/API_definitions/device-reachability-status-subscriptions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ paths:
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"410":
$ref: "#/components/responses/Generic410"
"429":
$ref: "#/components/responses/Generic429"
"500":
Expand Down Expand Up @@ -183,7 +181,7 @@ paths:
"409":
$ref: "#/components/responses/Generic409"
"422":
$ref: "#/components/responses/CreateSubscription422"
$ref: "#/components/responses/CreateSubscriptionUnprocessableEntity422"
"429":
$ref: "#/components/responses/Generic429"
"500":
Expand Down Expand Up @@ -220,6 +218,8 @@ paths:
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"503":
Expand Down Expand Up @@ -263,6 +263,8 @@ paths:
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"503":
Expand Down Expand Up @@ -302,6 +304,8 @@ paths:
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"503":
Expand Down Expand Up @@ -1023,50 +1027,49 @@ components:
InvalidArgument:
value:
status: 400
code: "INVALID_ARGUMENT"
message: "Client specified an invalid argument, request body or query param"
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query param
InvalidProtocol:
value:
status: 400
code: "INVALID_PROTOCOL"
message: "Only HTTP is supported"
code: INVALID_PROTOCOL
message: Only HTTP is supported
InvalidCredential:
value:
status: 400
code: "INVALID_CREDENTIAL"
message: "Only Access token is supported"
code: INVALID_CREDENTIAL
message: Only Access token is supported
InvalidToken:
value:
status: 400
code: "INVALID_TOKEN"
message: "Only bearer token is supported"
code: INVALID_TOKEN
message: Only bearer token is supported
Generic400:
description: Problem with the client request
description: Bad Request
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 400
code: "INVALID_ARGUMENT"
message: "Client specified an invalid argument, request body or query param"
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:
$ref: '#/components/headers/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"

code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or expired credentials.
CreateSubscription403:
description: Client does not have sufficient permission
headers:
Expand All @@ -1080,45 +1083,47 @@ components:
PermissionDenied:
value:
status: 403
code: "PERMISSION_DENIED"
message: "Client does not have sufficient permissions to perform this action"
code: PERMISSION_DENIED
message: Client does not have sufficient permissions to perform this action
TokenMismatch:
value:
status: 403
code: "SUBSCRIPTION_MISMATCH"
message: "Inconsistent access token for requested events subscription"

code: SUBSCRIPTION_MISMATCH
message: Inconsistent access token for requested events subscription
Generic403:
description: Client does not have sufficient permission
description: Forbidden
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 403
code: "PERMISSION_DENIED"
message: "Client does not have sufficient permissions to perform this action"
code: PERMISSION_DENIED
message: Client does not have sufficient permissions to perform this action
Generic404:
description: Resource Not Found
description: Not found
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 404
code: NOT_FOUND
message: "The specified resource is not found"
examples:
GENERIC_404_NOT_FOUND:
description: Resource is not found
value:
status: 404
code: NOT_FOUND
message: The specified resource is not found.
Generic409:
description: Conflict
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
Expand All @@ -1127,20 +1132,7 @@ components:
status: 409
code: CONFLICT
message: "The specified resource is in a conflict"
Generic410:
description: Gone
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 410
code: GONE
message: "The specified resource is no longer available at the requested address"
CreateSubscription422:
CreateSubscriptionUnprocessableEntity422:
description: Unprocessable Entity
headers:
x-correlator:
Expand All @@ -1153,8 +1145,20 @@ components:
PermissionDenied:
value:
status: 422
code: "MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED"
message: "Multi event types subscription not managed"
code: MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED
message: Multi event types subscription not managed
DeviceIdentifierMismatch:
description: Inconsistency between device identifiers not pointing to the same device
value:
status: 422
code: DEVICE_IDENTIFIERS_MISMATCH
message: Provided device identifiers are not consistent.
DeviceNotApplicable:
description: Service is not available for the provided device
value:
status: 422
code: DEVICE_NOT_APPLICABLE
message: The service is not available for the provided device.
Generic429:
description: Too Many Requests
headers:
Expand All @@ -1164,36 +1168,48 @@ components:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 429
code: TOO_MANY_REQUESTS
message: "Endpoint does not support as many requests per time slot"
examples:
GENERIC_429_QUOTA_EXCEEDED:
description: Request is rejected due to exceeding a business quota limit
value:
status: 429
code: QUOTA_EXCEEDED
message: Either out of resource quota or reaching rate limiting.
GENERIC_429_TOO_MANY_REQUESTS:
description: API Server request limit is overpassed
value:
status: 429
code: TOO_MANY_REQUESTS
message: Either out of resource quota or reaching rate limiting.
Generic500:
description: Server error
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 500
code: "INTERNAL"
message: "Server error"
code: INTERNAL
message: Server error
Generic503:
description: Service unavailable. Typically the server is down.
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 503
code: "UNAVAILABLE"
message: "Service unavailable"
examples:
GENERIC_503_UNAVAILABLE:
description: Service is not available. Temporary situation usually related to maintenance process in the server side
value:
status: 503
code: UNAVAILABLE
message: Service Unavailable.
SubscriptionIdRequired:
description: Problem with the client request
headers:
Expand Down
Loading

0 comments on commit f089994

Please sign in to comment.