confetti / confetti/confetti-node
Array filter values are serialised as indexed keys and rejected by the API (HTTP 500)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 51m
- Merged PRs (30d)
- 2
Description
What happens
src/adapter.ts serialises options with qs.stringify and no arrayFormat:
search: qs.stringify({ filter, sort, page, include: processedInclude })
qs defaults to the indices format, so an array filter value becomes:
filter[status][0]=attending
The API rejects that shape. Verified against the live API on /tickets:
| Request | Result |
|---|---|
filter[status][0]=attending (what the client sends) |
HTTP 500 |
filter[status]=attending |
200 |
filter[status]=waitlist,attending |
200, and genuinely ORs — 25 records where waitlist alone returns 0 |
So the API wants a comma-separated list, and the client cannot currently produce one.
Why it matters
status is declared type: 'array' in the registry for both ticket and payment:
filters.status = { type: 'array', values: [ /* attending, waitlist, declined, invited, ... */ ] }
So the schema tells a consumer that an array is the correct input, and passing that array produces a 500. Anything generating tool schemas from the registry — which is exactly what schemaToJsonSchema and the filter metadata are for — will steer callers into the failing shape. We hit this from a real client:
confetti_tickets_find_all { filter: { eventId: 141404, status: ['attending'] } }
-> Error: HTTP 500
The failure is also opaque: a bare HTTP 500 with no body (see #34's sibling problem — non-400 responses are discarded before the caller sees them), so there is nothing to indicate the array was the cause.
payment.status has the same declaration and the same issue.
Suggested fix
Either serialise arrays as a comma list:
search: qs.stringify({ filter, sort, page, include: processedInclude }, { arrayFormat: 'comma' })
or collapse array filter values before stringifying, if comma affects other option shapes you would rather leave alone. include is already comma-joined by hand a few lines above, so comma is evidently the format the API expects for multi-value parameters generally.
Worth confirming which statuses the API accepts together while you are in there — the OR behaviour above is inferred from record counts, not documented.
Workaround for consumers
Join array filter values with commas before calling. That is what we now do downstream.
Contributor guide
No contributing guide indexed for this repository
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 in src/adapter.ts at the qs.stringify call and inspect how filter values for ticket and payment status are serialized. Check the registry and schemaToJsonSchema metadata to confirm the array declaration, then verify that the resulting request uses the API-accepted comma-separated shape for single and multiple statuses without changing include handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 76/100