Listing saved cards without passing in sortOrder causes `BAD_REQUEST` error
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api
Research direction
Start at the cards.list entry point and trace how the optional sortOrder value is serialized into the request URL. Verify that omitting sortOrder no longer produces an empty sort_order query parameter, while an explicit value such as DESC remains supported and the list request succeeds.
Written by the indexing model from the issue text.
Description
Library Version: 44.2.0
const cards = await client.cards.list({
customerId: squareCustomerId,
});
Response
Body: {
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "INVALID_ENUM_VALUE",
"detail": "`` is not a valid enum value for `sort_order`.",
"field": "sort_order"
}
]
}
"rawResponse":{"headers":{},"redirected":false,"status":400,"statusText":"Bad Request","type":"basic","url":"https://connect.squareupsandbox.com/v2/cards?customer_id=<redacted>&sort_order="},
Expected behaviour
Not passing sortOrder should just return the default, presumably by just removing the &sort_order= query from the url when not provided.
Workaround
const cards = await client.cards.list({
customerId: squareCustomerId,
sortOrder: 'DESC',
});
- Dominant language
- TypeScript
- Stars
- 116
- Forks
- 48
- Avg merge
- 2h 13m
- Merged PRs (30d)
- 1
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.
More from square/square-nodejs-sdk
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
square/square-nodejs-sdk#237 · 3 comments ·
All issues in square/square-nodejs-sdk
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100