Skip to content

Polymorphic serializer not working as expected for 400 Bad Request #11

@mdefeche

Description

@mdefeche

Hello,

First of all, thank you for the new release, it's very neat. I could totally get rid of my own custom AutoSchema =)

I noticed that the polymorphic serializer used for the 400 Bad Request is not rendered as expected on Redoc as shown below. I would expect to have validation_error and parse_error shown in the dropdown but it only shows null

While reading the code, I also noticed that the ParseErrorReponseSerializer is using the ClientErrorEnum class. Shouldn't it be the ParseErrorCodeEnum class instead ?

class ParseErrorResponseSerializer(serializers.Serializer):
    type = serializers.ChoiceField(choices=ClientErrorEnum.choices)
    errors = ParseErrorSerializer(many=True)

image

Thanks again for the hard work !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions