Description
I have the feeling we could simplify Field._serialize
signature from _serialize(self, value, attr, obj, **kwargs)
to _serialize(self, value)
.
From a quick search, obj
is used in Nested
to populate the ValidationError
. I need to get my head around this. Shouldn't it be nested_obj
?
It is also used in FormattedString
. This field achieves a function that could be achieved otherwise (property, pre_dump,...). I think it could be dropped without too much collateral damage.
There may be an issue with Function
, too.
I didn't see where attr
and kwargs
are used.
It boils down to whether a field should have access to the whole structure or only its own value.
This is more or less related to #799 and probably #900/#940.
Edit: Marking as 3.0 because it is a breaking change, but it could be postponed, just like #799. If my intuition is correct, it could make for a simpler and saner interface, forbidding hard-to-debug corner cases.