-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raising ValidationError from Serializer.to_internal_value() with error message(s) as list causes ValueError #3864
Comments
Breaking changes in usage self.errors instead self._errors in older versions. From official documentation:
I think, line value = self.to_internal_value(data) should be under try-except to proper exception converting. |
Original to_internal_value always raises exception in dict-format: |
This should probably at least be mentioned in the docs somewhere? |
I'm also experiencing this issue. Raising a validation error inside to_internal_value throws the same exception as above. This can be handled outside to_internal_value so it isn't a blocker by any means. |
This issue can also be seen if you pass
I believe this error could be avoided by wrapping |
I'm going to de-milestone for now. We can reassess after v3.7 |
Hi all, I've opened #5466 with a docs clarification. In short, the recommended approach is:
|
#5466 Is a good start, but I think we want to restructure that slightly. The opening paragraphs for that section might be the right place make your validate vs to_internal_value point, tho I'm open to discussion here. |
This seems to happen because
Serializer.errors
passesself._errors
to ReturnDict without type-checking the wayListSerializer.errors
does.The text was updated successfully, but these errors were encountered: