-
Notifications
You must be signed in to change notification settings - Fork 51
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
Query to only return specific fields set #180
Comments
For a single instance, maybe this would do: from flask_potion import routes, fields
@routes.ItemRoute.GET
def filtered(self, item, fields: fields.Array(fields.String)):
return {f: getattr(item, f) for f in fields} And pass the attributes you want to include in the body of the GET request. Not sure if it's the best practice (and probably way too late response anyway), but I guess it's an option 🤷 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to reduce the amount of data being transferred from a resource, is it possible to provide a query args to return a set of fields?
Sometimes, we don't need all attributes of an object but a couple of them.
It would require too many custom routes to expose the different set of attributes we would need.
Here a few examples to describe it:
The text was updated successfully, but these errors were encountered: