Hello all,

When using viewsets.ViewSet, it seems impossible to make the schema 
generation introspection (for django rest swagger or open api) to find the 
correct serializer class in order to build the body params.

I know you could use GenericViewSet, since the requirement is that there's 
get_serializer method on the class, but I can't seem to find a way, if any, 
to return a different serializer per view set method which should be a 
normal use case.

I ended up addin a mixin class that adds the required get_serializer, and 
get_serializer_class methods so it would work with a plain ViewSet class, 
but this also forces me to define a dictionary that maps every action to a 
serializer at the class level so each action can use it's own serializer 
which makes it quite verbose.

There's also the issue about query string parameters, currently, there's no 
way to manually define query string parameters. What happens if a 
serializer is used to parse the data that comes from a query string? It 
really seems the schema functionality is only made to work with model 
serializers. It would be a good idea to allow some flexibility so plain 
ViewSets are not left out, or am I missing something?

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to