-
Notifications
You must be signed in to change notification settings - Fork 299
Description
I would like the Sparse Fieldsets feature:
http://jsonapi.org/format/#fetching-sparse-fieldsets
I tried to implement it and thought creating a custom serializer and override rest_framework.serializers.Serializer.fields property.
However, we need the resource_name to get the fields[TYPE] query parameter value (TYPE=resource_name).
I find rest_framework_json_api.utils.get_resource_name, however its argument rendrerer_context is created after the serializer returns data. For example, in ListModelMixin, rendered_context is created in Response(serializer.data) at https://github.com/tomchristie/django-rest-framework/blob/8cae462b3a3d724cf83fd33572c0ea23f91f2278/rest_framework/mixins.py#L47-L48)
So how should we implement the Sparse Fieldsets feature?