Skip to content

Commit 1be084f

Browse files
committed
Fix nested partial to use attr_name instead of data_key
When building dot-delimited sub_partial for nested schemas, the prefix was computed from field_name (which is data_key when set) instead of attr_name. Since users specify partial fields using attribute names like partial=("nested_field.child",), the prefix needs to match attr_name. When data_key differs from attr_name, the prefix mismatch caused the nested partial list to always be empty, so the nested schema never received the partial option and required fields raised unexpected validation errors.
1 parent 2a3812d commit 1be084f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/marshmallow/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def _deserialize(
654654
d_kwargs = {}
655655
# Allow partial loading of nested schemas.
656656
if partial_is_collection:
657-
prefix = field_name + "."
657+
prefix = attr_name + "."
658658
len_prefix = len(prefix)
659659
sub_partial = [
660660
f[len_prefix:] for f in partial if f.startswith(prefix)

0 commit comments

Comments
 (0)