interledger / interledger/open-payments-node
Improve error message when schema doesn't match
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 4
- Avg merge
- 27m
- Merged PRs (30d)
- 3
Description
As an example, when creating a grant request, the access_token can have 3 options: access-incoming, access-outgoing and access-quote.
Use type: "outgoing-payment" there, but forget to provide the identifier field. Now schema won't match access-outgoing anymore.
Expected error: field identifier is required with type: "outgoing-payment"
Received error: body.access_token.access.0.type must be equal to one of the allowed values
So, missing identifier switched schema to be access-quote (as it's only option without this field), but then it expected type to be "quote", hence the incorrect error message.
Same problem can extend to other request bodies.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the grant-request example with an outgoing-payment access token that omits identifier, then trace the schema-validation entry point for request bodies. Confirm the error reports the missing identifier and preserves the relevant schema context, and check that equivalent mismatches in other request bodies remain understandable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100