Add validate method back to ListSerializer#2225
Add validate method back to ListSerializer#2225LilyFirefly wants to merge 1 commit intoencode:masterfrom
Conversation
There was a problem hiding this comment.
This is a large copy/paste from Serializer.run_validation. I would prefer to refactor this to be more DRY, but I'm not sure how best to do this.
There was a problem hiding this comment.
If we dropped the ValidationError and DjangoValidationError handling code into a function that takes an exception and returns the details for ValidationError to be raised, we could have that just in once place, which would be better.
There was a problem hiding this comment.
We could also consider pushing this... https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/fields.py#L307-L320 into a validate_empty_vaues
There was a problem hiding this comment.
I would probably recommend we drop the call to super here, in the same way we do for Serializer. It gets pretty confusing otherwise. This'd also let us move the if not isinstance(data, list) check out of to_internal_value which would be nicer and would mirror the Serializer classes if not isinstance(data, dict) check that occurs.
|
Going to take a look at some of this now based on your input. |
Fixes #2168.