Skip to content

Is there a way to recursively prefer _cattrs_use_alias=True? #596

Closed
@BrianPugh

Description

@BrianPugh

In my application, i have several nested structures that have attrs aliases set (e.g. field(..., alias="foo")). I am aware that I could individually register a hook for every class with:

converter.register_structure_hook(
    MyClass,
    make_dict_structure_fn(MyClass, converter, _cattrs_use_alias=True),
)

However, this requires the developer to remember to do that for every new class. Is there a way of applying this setting for the whole converter?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions