manosim / manosim/django-rest-framework-docs

Support for dynamic fields?

Open
#89 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
641
Forks
178
PR merge metrics
No merged PRs in 30d

Description

Hey there, DRF docs looks really cool. But it looks like the project doesn't currently have support for viewsets that implement a `get_serializer` method. In my case, I use information from the request (specifically the token scopes) to determine the fields available to the client. This means that it's an error to instantiate a serializer without providing a request variable in a `context` kwarg. And DRF-docs does exactly this in `api_endpoint.py:50`

Is there any way I can override the methods that determine fields to show? Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by reading api_endpoint.py:50 and tracing how viewsets using get_serializer are handled, especially serializer construction and the request context. Done means the project has a documented, supported way to accommodate serializers whose available fields depend on request token scopes, with the override point clearly identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.