Closed arlopezg closed 3 years ago
Did you find how to do this, @arlopezg ?
I am currently having the same issue
I ended up using drf-spectacular and it worked out just fine, no dice doing it with YASG. You may want to look into making the move.
Awesome, @arlopezg ! Thank you very much, I will check it out
Just leaving this here in case other people are having trouble with this.
I used the query_serializer
parameter:
from rest_framework import serializers
from rest_framework import viewsets
from drf_yasg.utils import swagger_auto_schema
class CustomParametersSerializer(serializers.Serializer):
myparam = serializers.CharField(help_text="My manual querystring parameter")
class MyViewSet(viewsets.ViewSet):
@swagger_auto_schema(query_serializer= CustomParametersSerializer)
def my_route(self, request):
...
Hello,
I've started to document an API with YASG. So far it's worked very well, the only trouble I've had has been using nested serializers, and the doubts stem from:
query_serializer
to describe the request params.Example:
Result If I try to generate my schema, I get the following error:
drf_yasg.errors.SwaggerGenerationError: cannot instantiate nested serializer as Parameter
I get that nested params are not allowed in
query_serializer
- but what else can I do to describe this request parameters?