JsonField source and validate(self, attrs) might have a mismatch #9478
Unanswered
kxtells
asked this question in
Potential Issue
Replies: 1 comment
-
For what I know this is a behaviour which has been in DRF for long time. Maybe it is not well documented, the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone.
I have a situation that seemed strange at first and thought to ask if it is intended behaviour or something unexpected for 3.15.1.
In this code example I provide the smallest example I could come up with that creates this situation.
In this case I have a Comment class, that I serialize via a
CommentSerializer
that declares a specificsource
function to fill up the given field.Alongside this we have some specific
validate(self, data)
for this serializer.I would expect the validation payload to come as
But instead it comes as
I imagine that if the source points to an attribute this behaviour would not be too bad, but when pointing to a function it seems strange to me.
As said, I'm just wondering if this is intended or it's some unexpected behaviour.
Salut, and thanks for the hard work!
Beta Was this translation helpful? Give feedback.
All reactions