Skip to content

How to use partial loading with nested field #718

@boomjuice

Description

@boomjuice
@use_kwargs(
        {
            'insert_rows':
                wf.List(wf.Nested(SysRoleResourceSchema(load_instance=False)),
                        allow_none=True),
            'update_rows': wf.List(wf.Nested(SysRoleResourceSchema(load_instance=False, partial=True)),
                        allow_none=True),
            'delete_rows':
                wf.List(wf.Int())
        },
        location='json')
    def union_operate(self, insert_rows: t.List[dict],
                      update_rows: t.List[dict], delete_rows: t.List[int]):
        self.service.union_operate(insert_rows, update_rows, delete_rows)
        return self.response_cls.success()

I want get update_rows to update my data, but partial=True cant take effect, how can I make it take effect?
I checked marshmallow docs that say only take effect when you use schema.load(xxx, partial=True)
here is the docs link : https://marshmallow.readthedocs.io/en/stable/nesting.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions