Hello, i'm using custom class validator to validate serializer fields, and i would like to raise ValidationError for all fields, instead now i'm getting the validation error only for single fields. Before i've used method validations inside my serialzier and it worked as i need, but this is nto the case with class validators.
Here is how validators looks like class TitleValidator: MIN_TITLE_LENGTH = 20 def __call__(self, attrs: dict): title = attrs.get("title", "") if len(title) < self.MIN_TITLE_LENGTH: raise ValidationError(f"Min title length is {self. MIN_TITLE_LENGTH}") return title class SlugsValidator: def __call__(self, attrs): slug = attrs.get("slug", "") if len(slug) < 10: raise ValidationError("Slug must be at least 10 characters long" ) return slug Inside my serializer i'm using validators inside Meta class. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/e1f538ad-b610-4924-9978-972bc11dd0c1n%40googlegroups.com.