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 exclusion implentation #91

Closed
RandyRomero opened this issue Jul 2, 2024 · 2 comments
Closed

Sparse Fieldsets exclusion implentation #91

RandyRomero opened this issue Jul 2, 2024 · 2 comments

Comments

@RandyRomero
Copy link

RandyRomero commented Jul 2, 2024

First of all, thank you for your work!

The issue I'll describe here is a minor things and more like a nit-picking than an actual problem.
One of pros JSONAPI API'S is that the client can specify what set of fields it want to be returned (instead of all fields)

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

FastAPI-JSONAPI supports this feature, but in their own way. It selects all the fields from a database table, then get rid of unneeded once while preparing the response. So fields that are not requested by the client are not transferred via HTTP, but still get pulled from the database. It is not critical, but also is not optimal. I am wondering why you don't exclude fiends while building query with SQLAlchemy?

https://github.com/mts-ai/FastAPI-JSONAPI/blob/main/fastapi_jsonapi/views/utils.py#L154

@m-antonov
Copy link
Collaborator

@RandyRomero thank you for your patience. I invite you to test the updated version of the library #97, where sparse fieldsets are implemented according to the specification, and database queries are executed optimally. Feel free to open a new issue if you encounter any problems with the updated version.

@RandyRomero
Copy link
Author

@m-antonov oh, there is a new version? I am excited to hear that! I'll try to get it a go in the upcoming days or weeks (we are using it at work, so I am gonna need to allocate some time for experimenting with the update)

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

No branches or pull requests

2 participants