I'd like to document input schemas and output schemas for GET request with drf-yasg.
It doesn't seem to be easy.
@swagger_auto_schema(
manual_parameters=[
openapi.Parameter('cart_id', in_=openapi.IN_QUERY,
type=openapi.TYPE_INTEGER)
])
The above code shows the GET parameter, but somehow hides the response schema.
@swagger_auto_schema(methods=['put', 'post'], request_body=UserSerializer)
I can't use request_body for GET query parameters, it's only for post body
So How do I document my input schema and output schema with drf-yasg ?
You can use query_serializer
Found it https://medium.com/@arjunsinghy96/customised-api-documentation-for-django-rest-framework-projects-using-drf-yasg-d6db9ba5cff3
was hard to get it from the official doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With