Business API: improve handling of some schema errors
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 62
- Avg merge
- 24m
- Merged PRs (30d)
- 1
Description
In general, schema errors are handled by the API so that the response to the UI is meaningful (eg, contains a useful error message and error path). Eg,

However, some schema errors are improperly handled and do not provide the UI with the expected response. Eg,

(The above was simulated by filing an IA missing the contactPoint object.)
Here is the network response. The UI expects errors[0].error to be the message presently stored in errors[0].context[0].message. I also question why the context object is provided at all.

Vysakh looked at the code with me and is unsure why the response is as above -- it would take more digging and that's why I created this ticket.
The above scenario should never be seen by regular users as this would indicate a code error (vs a data error). However, API users might see the above.
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is identified in the issue. Trace the schema-error handling that produces the API response, compare the expected errors[0].error with the current errors[0].context[0].message, and inspect the missing contactPoint scenario. Done means API users receive the expected meaningful error message and path without the unexpected context shape.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100