OpenBankProject / OpenBankProject/OBP-API

All invalid api calls should always show feedback when possible

Open
#1,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.7k
Forks
482
Avg merge
1d 12h
Merged PRs (30d)
15

Description

Scenario

Developer using api submits a post request to /obp/v3.1.0/banks/BANK_ID/customers with an invalid value for kyc_status

Expected response:

When possible, the api response must inform the api user which field is invalid.

Actual response:

{"code":400,"message":"OBP-10001: Incorrect json format. The Json body should be the PostCustomerJsonV310 "}

Motivation

Developers should be able to troubleshoot api responses themselves, provided there is enough error feedback based on the structure of the data they send.

The actual repose is not helpful. Out of 22 possible data-points for this api call, the developer has no clue which properties are invalid.

Proposed solution:

use display_internal_errors or provide api validation only errors

When we enable the props setting display_internal_errors=True
Then the error message is more useful, for example:

{"code":400,"message":"OBP-10001: Incorrect json format. The Json body should be the PostCustomerJsonV310 <- No usable value for kyc_status\nDo not know how to convert JString(TRUE) into boolean"}
Right away , as an API user, it is possible to see the error is with the kyc_status property. The developer can now easily focus on correcting the data they are sending.

There is concern @hongwei1 that display_internal_errors is too broad for this , as it may show internal errors which are sensitive. Therefore maybe a more granular setting is needed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the POST /obp/v3.1.0/banks/BANK_ID/customers path and trace how an invalid kyc_status becomes the generic response. Compare the current behavior with display_internal_errors and determine what field-level feedback can be exposed without revealing sensitive internal errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.