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.
Don't use a serializer for the nested field. Use a DictField, or something else that reflects a more lenient set of validation constraints.