Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Improvement: POST /v1/organisation/accounts error response #74

@emiliosa

Description

@emiliosa

Message response from POST /v1/organisation/accounts endpoint is not accurate enough when dealing with errors.

Request:

curl --location --request POST 'http://0.0.0.0:8081/v1/organisation/accounts'
--header 'Accept: application/json; charset=utf-8' \
--header 'Content-Type: application/json' \
--data-raw '{
  "data": {
    "id": "5cfa2634-b595-4123-a5c5-d2e2bd1257a5",
    "organisation_id": "bb2c9922-114c-42e0-acbd-04214b552ffe",
    "type": "account",
    "attributes": {
    	"base_currency": "GBP",
    	"name": [
    		"Emiliano"
    	],
        "bank_id": "TEST",
        "bank_id_code": "TEST",
        "bic": "NWBKGB",
        "account_classification": "Personal"
    }
  }
}'

Response:

{
    "error_message": "validation failure list:\nvalidation failure list:\ntype in body should be one of [accounts]"
}

Response proposal:

{
    "code": 400,
    "message": "validation failure list:\nvalidation failure list:\nvalidation failure list:\nbic in body should match '^([A-Z]{6}[A-Z0-9]{2}|[A-Z]{6}[A-Z0-9]{5})$'\ncountry in body is required\ntype in body should be one of [accounts]",
    "errors": [
        {
            "validation_failure": {
                "type": "type in body should be one of [accounts]",
                "bic": "bic in body should match '^([A-Z]{6}[A-Z0-9]{2}|[A-Z]{6}[A-Z0-9]{5})$'",
                "country": "country in body is required"
            }
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions