-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Sometimes, drf-yasg can't figure out the appropriate serializer for a class. That's not a problem if we have a serializer on hand to pass to schema:
@schema(responses={200: MySerializer})
def get(...):
""" My view """For paginated views, this becomes a problem, because we don't have a paginated serializer to give schema.
I see two solutions to this:
1. Help drf-yasg figure out paginated serializers better
Why can't drf-yasg generate a correct paginated response schema? Are we missing a class variable on our views? Are we using DRF wrong?
2. Provide a manual paginate_serializer function as a fall-back
In the case where drf-yasg just can't figure out the response schema, it'd be great to be able to do something like:
@schema(responses={200: paginate_serializer(MySerializer, MyPaginationClass)})
def get(...):
""" My paginated view """Metadata
Metadata
Assignees
Labels
No labels