Uncategorized · October 14, 2021 0

Django – Django Swagger add custom list of request body params to expect

So for Django Rest Swagger you can add a way to list the params in the request body for example:

@api_view(['POST'])
@swagger_auto_schema(
    request_body=Serializer,
)

How can I change it so that request_body takes in a list of expected request body attributes? Because I have a post endpoint that should take in a request body of lots of attributes and apply 2 serializers on it, where each serializer will only serialize the attributes that it requires. Is there a way to do this?