You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At this point, a Nested field with the many=True parameter and a Nested field wrapped in the List will serialize None items differently: the first one will return a list of empty dictionaries, the latter one will return a list of None.
It’s unclear if it’s intentional or not, but it’s frustrating to say at least because these two concepts presumably imply to be interchangeable. Of course, #779 exists not without reason, but it’s a more complicated matter, and it’ll celebrate its second birthday in a few days.
So the main question here is: should it stay inconsistent by design or one approach is provenly false, and needs to be fixed.
Just in case, it’s easy to reproduce with the following example:
Ah, I completely overlooked #1497, so it’s a kinda-duplicate, but that issue already closed and has no explicit resolution on the question above. It would be great to have a more distinct view on this subject, if possible. Please, correct me if I missed something.
While working on #1498, @Meallia uncovered that Nested(many) does not support enabling allow_none for list items. Schema.load() has no concept of allow_none, so it will always implicitly be true.
I think the issue is that changing this behavior for Nested(many) would require a major version bump, but there is a desire to just deprecate Nested(many) instead. Either way the discussion for this should probably continue on #779.
At this point, a
Nested
field with themany=True
parameter and aNested
field wrapped in theList
will serializeNone
items differently: the first one will return a list of empty dictionaries, the latter one will return a list ofNone
.It’s unclear if it’s intentional or not, but it’s frustrating to say at least because these two concepts presumably imply to be interchangeable. Of course, #779 exists not without reason, but it’s a more complicated matter, and it’ll celebrate its second birthday in a few days.
So the main question here is: should it stay inconsistent by design or one approach is provenly false, and needs to be fixed.
Just in case, it’s easy to reproduce with the following example:
The text was updated successfully, but these errors were encountered: