drf-yasg icon indicating copy to clipboard operation
drf-yasg copied to clipboard

Response schemas from serializers will optionally be paginated

Open PaulWay opened this issue 5 years ago • 8 comments

At the moment, if a non-default response serializer is set via responses in swagger_auto_schema, it will not pick up any pagination schema that might apply from any paginator inspectors.

This patch will take any serializers provided in the responses section and apply a pagination schema to them if the view should be paged. This does not apply to the default serializer from get_default_responses because that is already converted into a schema.

Signed-off-by: Paul Wayper [email protected]

PaulWay avatar Nov 22 '19 05:11 PaulWay

@axnsan12 wondering if it is possible to merge this PR?

nicholasgcoles avatar Aug 02 '20 08:08 nicholasgcoles

@PaulWay do you have a workaround for this?

nicholasgcoles avatar Aug 02 '20 08:08 nicholasgcoles

Yeah, unfortunately the workaround is to subclass the view inspector and copy the get_response_schemas method, using my version of the code.

@axnsan12 What's your take on this?

PaulWay avatar Aug 03 '20 11:08 PaulWay

Yeah, unfortunately the workaround is to subclass the view inspector and copy the get_response_schemas method, using my version of the code.

@axnsan12 What's your take on this?

Could you please provide an example with code (the workaround) that works for this use-case? Thanks.

sondrewb avatar Aug 13 '20 06:08 sondrewb

@axnsan12 this would be very helpful to have (assuming it's fixed)

kavdev avatar Oct 02 '20 17:10 kavdev

Any chance there is an update on this? Such a useful feature.

nicholasgcoles avatar Jan 27 '21 13:01 nicholasgcoles

Sorry, have had this on the back burner - will update this soon!

PaulWay avatar Jan 30 '21 05:01 PaulWay

Some update about this issue? What's missing to finish and release it?

gabrieldev525 avatar Apr 11 '22 21:04 gabrieldev525