From 73a5ddc925e909fed71a39d55aeec58899c8390b Mon Sep 17 00:00:00 2001 From: PEDRO DIEZ GARCIA Date: Sat, 19 Oct 2024 12:33:12 +0200 Subject: [PATCH] exceptions_alignment --- .../blockchain-public-address.yaml | 129 ++++++++++++------ 1 file changed, 84 insertions(+), 45 deletions(-) diff --git a/code/API_definitions/blockchain-public-address.yaml b/code/API_definitions/blockchain-public-address.yaml index b7830fd..859a8a6 100644 --- a/code/API_definitions/blockchain-public-address.yaml +++ b/code/API_definitions/blockchain-public-address.yaml @@ -344,22 +344,26 @@ components: schema: $ref: "#/components/schemas/ErrorInfo" examples: - InvalidArgument: + GENERIC_400_INVALID_ARGUMENT: + description: Invalid Argument. Generic Syntax Exception value: status: 400 code: INVALID_ARGUMENT - message: Client specified an invalid argument, request body or query param - InvalidBlockchainNetworkId: + message: Client specified an invalid argument, request body or query param. + GENERIC_400_INVALID_BLOCKCHAIN_NETWORK_ID: + description: blockchainNetworkId is not valid value: status: 400 code: BLOCKCHAIN_PUBLIC_ADDRESS.INVALID_BLOCKCHAIN_NETWORK_IDENTIFIER message: Indicated blockchainNetworkId is not valid - InvalidCurrencyForBlockchain: + GENERIC_400_INVALID_CURRENCY_FOR_BLOCKCHAIN: + description: Invalid currency value: status: 400 code: BLOCKCHAIN_PUBLIC_ADDRESS.INVALID_CURRENCY message: Indicated currency is not found - RequiredCurrencyForBlockchain: + GENERIC_400_REQUIRED_CURRENCY_FOR_BLOCKCHAIN: + description: Currency is required value: status: 400 code: BLOCKCHAIN_PUBLIC_ADDRESS.CURRENCY_REQUIRED @@ -377,12 +381,14 @@ components: 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: "Operation not allowed: ..." - NotAllowedBlockchainNetworkId: + message: Client does not have sufficient permissions to perform this action. + GENERIC_403_NOT_ALLOWED_BLOCKCHAIN_NETWORK_ID: + description: blockchainNetworkId not allowed by business rules value: status: 403 code: BLOCKCHAIN_PUBLIC_ADDRESS.BLOCKCHAIN_NETWORK_IDENTIFIER_NOT_ALLOWED @@ -396,12 +402,15 @@ components: application/json: schema: $ref: "#/components/schemas/ErrorInfo" - example: - status: 400 - code: INVALID_ARGUMENT - message: Client specified an invalid argument, request body or query param + examples: + GENERIC_400_INVALID_ARGUMENT: + description: Invalid Argument. Generic Syntax Exception + value: + status: 400 + 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: $ref: '#/components/headers/x-correlator' @@ -409,10 +418,19 @@ components: 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. Generic403: description: Forbidden headers: @@ -422,10 +440,13 @@ components: application/json: schema: $ref: "#/components/schemas/ErrorInfo" - example: - status: 403 - code: PERMISSION_DENIED - message: "Operation not allowed: ..." + examples: + 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. Generic404: description: Not found headers: @@ -435,10 +456,13 @@ components: 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: @@ -448,10 +472,13 @@ components: application/json: schema: $ref: "#/components/schemas/ErrorInfo" - example: - status: 409 - code: ALREADY_EXISTS - message: "A specified resource duplicate entry found" + examples: + GENERIC_409_ALREADY_EXISTS: + description: Trying to create an existing resource + value: + status: 409 + code: ALREADY_EXISTS + message: The resource that a client tried to create already exists. Generic429: description: Too Many Requests headers: @@ -461,10 +488,13 @@ components: application/json: schema: $ref: "#/components/schemas/ErrorInfo" - example: - status: 429 - code: TOO_MANY_REQUESTS - message: Either out of resource quota or reaching rate limiting + examples: + 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: @@ -474,10 +504,13 @@ components: application/json: schema: $ref: "#/components/schemas/ErrorInfo" - example: - status: 500 - code: INTERNAL - message: Server error + examples: + GENERIC_500_INTERNAL: + description: Problem in Server side. Regular Server Exception + value: + status: 500 + code: INTERNAL + message: Unknown server error. Typically a server bug. Generic503: description: Service unavailable headers: @@ -487,10 +520,13 @@ components: 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. Generic504: description: Request time exceeded. If it happens repeatedly, consider reducing the request complexity headers: @@ -500,7 +536,10 @@ components: application/json: schema: $ref: "#/components/schemas/ErrorInfo" - example: - status: 504 - code: TIMEOUT - message: Request timeout exceeded + examples: + GENERIC_504_TIMEOUT: + description: API Server Timeout + value: + status: 504 + code: TIMEOUT + message: Request timeout exceeded.