Export enums with drf-yasg to Swagger: Works in responses serializers but not in query_serializer

68 Views Asked by At

I have a viewset with a method with this swagger_auto_schema decorator:

@swagger_auto_schema(
    responses={200: MyResponseSerializer(many=True)}, 
    query_serializer=MyQuerySerializer
)

When I define serializers.ChoiceField(choices=...) in MyResponseSerializer, the enum for the choices are outputted to Swagger schema. When I use ChoiceField in MyQuerySerializer, this is not outputted.

Is this by design? Is there a straightforward way of exporting choices enums for query_serializers, too?

0

There are 0 best solutions below