Skip to content

More precise field paths for collections #281

@brendonky18

Description

@brendonky18

Is your feature request related to a problem? Please describe.
I have to parse a large configuration file, part of which is essentially a dictionary of structured objects. Currently if an error occurs while parsing one of these objects, dacite does not tell you which specific key the error occurred in, which can be annoying to hunt down when dealing with large dictionaries.

Describe the solution you'd like
When a DaciteFieldError is raised while building a member of a collection, update the field path to include a reference to which member the error occurred in. In the case of a dictionary or other mapping, this would be the key. In a Sequence-like collection (tuples and lists) this would be the index. This would make it akin to how pydantic represents these errors.

I already have a mocked-out version that we are using, so I would be happy to submit a PR if this is accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions