laravel-orion
laravel-orion copied to clipboard
Sparse Fieldsets
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?
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.
This would be really handy to have. Would you be open to a PR?
Hi @glennjacobs,
Sure, PRs are always welcome ~
@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.
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.
@alexzarbn @olragon
I created a simple implementation of this.
https://github.com/tailflow/laravel-orion/pull/226 https://github.com/tailflow/laravel-orion-ts/pull/36
Edit: updated them to use sparse fieldsets.
This should be mentioned in the RADME along with other essential functionality that is not available in this package.