Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse Fieldsets #128

Open
olragon opened this issue Oct 1, 2021 · 7 comments
Open

Sparse Fieldsets #128

olragon opened this issue Oct 1, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@olragon
Copy link

olragon commented Oct 1, 2021

https://jsonapi.org/format/#fetching-sparse-fieldsets

A client MAY request that an endpoint return only specific fields in the response on a per-type basis by including a fields[TYPE] parameter.

Can we implement this usage pattern?

@alexzarbn alexzarbn added the enhancement New feature or request label Oct 4, 2021
@alexzarbn
Copy link
Member

Hi @olragon,

It is currently not supported and there is no scheduled milestone for this feature yet. Leaving the issue open to see, if more developers would need that functionality.

@glennjacobs
Copy link

This would be really handy to have. Would you be open to a PR?

@alexzarbn
Copy link
Member

Hi @glennjacobs,

Sure, PRs are always welcome ~

@rossity
Copy link
Contributor

rossity commented Feb 7, 2023

@alexzarbn

Just want to also add that this feature would be immensely useful, especially if you add support in the JS library. Would cut down a lot on having to write different controllers/resources/or other logic that removes certain fields from a search.

@emeGuan
Copy link

emeGuan commented Feb 22, 2023

Maybe someone might find it interesting.
https://github.com/emeGuan/laravel-resources
It is not a substitute for this fantastic Laravel Orion library, far from it. But it can be useful for someone who wants to build their API using https://laravel.com/docs/10.x/eloquent-resources
Regards.

@rossity
Copy link
Contributor

rossity commented May 17, 2023

@alexzarbn @olragon

I created a simple implementation of this.

#226
tailflow/laravel-orion-ts#36

Edit: updated them to use sparse fieldsets.

@cirrusmostar
Copy link

This should be mentioned in the RADME along with other essential functionality that is not available in this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants