interledger / interledger/open-payments-node

Improve error message when schema doesn't match

Open
#8 2 comments 0 reactions 0 assignees View on GitHub

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.