Skip to content

Disable validation on serializer completely (nested) #5046

@bryanph

Description

@bryanph

I am looking for a way to disable validation on a serializer in a nested way.
For example wth this code:

class SerializerTwo(serializers.Serializer):
    value_two = serializers.CharField()

class SerializerOne(serializers.Serializer):
    value_one = serializers.CharField()
    nested_value = AnotherSerializer(required=False)

I want to be able to post data of the form

{
    value_one: "abc",
    value_two: {
          // this shouldn't matter
    }
}

And not receive any validation errors no matter on how I set up the validation. I want this because I wrote my own validation methods that are shared with another part of the codebase. Hence, I don't want DRF interfering with that flow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions