|
5 | 5 |
|
6 | 6 | from pylasu.model import Node, Origin |
7 | 7 | from pylasu.model.errors import GenericErrorNode |
| 8 | +from pylasu.model.model import concept_of |
8 | 9 | from pylasu.model.reflection import PropertyDescription |
9 | 10 | from pylasu.transformation.generic_nodes import GenericNode |
10 | 11 | from pylasu.validation import Issue, IssueSeverity |
@@ -32,7 +33,7 @@ def set(self, node: Node, value): |
32 | 33 | class NodeFactory(Generic[Source, Output]): |
33 | 34 | constructor: node_factory_constructor_type |
34 | 35 | children: Dict[str, "ChildNodeFactory[Source, Any, Any]"] = field(default_factory=dict) |
35 | | - finalizer: Callable[[Source], None] = lambda _: None |
| 36 | + finalizer: Callable[[Source], None] = field(default=lambda _: None) |
36 | 37 |
|
37 | 38 | def with_child( |
38 | 39 | self, |
@@ -104,7 +105,7 @@ def transform_into_nodes(self, source: Optional[Any], parent: Optional[Node] = N |
104 | 105 | if factory: |
105 | 106 | nodes = self.make_nodes(factory, source) |
106 | 107 | for node in nodes: |
107 | | - for pd in type(node).node_properties: |
| 108 | + for pd in concept_of(node).node_properties: |
108 | 109 | self.process_child(source, node, pd, factory) |
109 | 110 | factory.finalizer(node) |
110 | 111 | node.parent = parent |
@@ -134,7 +135,7 @@ def process_child(self, source, node, pd, factory): |
134 | 135 | if child_node_factory != NO_CHILD_NODE: |
135 | 136 | self.set_child(child_node_factory, source, node, pd) |
136 | 137 | else: |
137 | | - # TODO should we support @Mapped? |
| 138 | + # TODO should we support @Mapped / dot-notation? |
138 | 139 | factory.children[child_key] = NO_CHILD_NODE |
139 | 140 |
|
140 | 141 | def as_origin(self, source: Any) -> Optional[Origin]: |
|
0 commit comments