-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Please adivse how to flatten objects with attribute-style access?
Documentation says that name_mapping map supports dictionary-style access.
For example, I would like to map nested_attr of Nested in Source to the same of Flat object:
@dataclass
class Nested:
nested_attr: str
@dataclass
class Source:
container: dict[str, Nested]
@dataclass
class Flat:
nested_attr: str
retort = ConversionRetort(
recipe=[
name_mapping(
Flat,
map = {
"nested_attr": ["container", "nested_key", "nested_attr"],
}
),
],
)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels