djangoserializationdjango-formsdjango-rest-framework

Serializer Equivalent of clean for django forms in rest framework Serializers


What is the serializer equivalent of the clean method for django forms.

My use case is that I want to do custom model field validation of some fields for a model serializer class. My guess is it could be the run_validators, for the framework. But I am not sure with certainty.

Thanks, Best regards,


Solution

  • Well, just gone through the documentation and the equivalent is validate (for object level validation). For field level validation use. validate_<field_name>'

    See link for more details