Sparse fieldsets returning all fields
- Dominant language
- TypeScript
- Stars
- 83
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Querying by sparse fieldsets is not behaving as expected. When trying to specify multiple fields for one resource, it does not work (all fields are returned). It works if you specify the multiple fields for the one resource across multiple query params.
- does not work, but should: [resource1]=field1,field2,field3
- workaround: [resource1]=field1&[resource1]=field2&[resource1]=field3
**To Reproduce**
Use the fields parameter with `useAll` or `useDataGridState`, it will structure the query in the jsonapi format, but the request will return all fields regardless.
**Expected behavior**
Using the [jsonapi](https://jsonapi.org/format/#fetching-sparse-fieldsets) URL format returns only specified fields.
Contributor guide
Research direction
Start by tracing how the `fields` parameter is handled when using `useAll` or `useDataGridState`, then compare the generated query with the JSON:API sparse fieldset format linked in the issue. Confirm the behavior with a request containing comma-separated fields and verify that the response contains only those fields, while repeated parameters remain supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100