Skip to content

Commit d41f54c

Browse files
committed
Changed helpers var name in _extract_data and typo in schema loader
1 parent 05e4f74 commit d41f54c

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,12 +1585,12 @@ def create_types_map(model: TypesMapModel, **kwargs: Any) -> TypesMap:
15851585
def create_schema_type_identifier(
15861586
self, model: SchemaTypeIdentifierModel, config: Config, **kwargs: Any
15871587
) -> SchemaTypeIdentifier:
1588-
types_map = []
1588+
types_mapping = []
15891589
if model.types_mapping:
1590-
types_map.extend(
1590+
types_mapping.extend(
15911591
[
1592-
self._create_component_from_model(types_pair, config=config)
1593-
for types_pair in model.types_mapping
1592+
self._create_component_from_model(types_map, config=config)
1593+
for types_map in model.types_mapping
15941594
]
15951595
)
15961596
model_schema_pointer: List[Union[InterpolatedString, str]] = (
@@ -1605,7 +1605,7 @@ def create_schema_type_identifier(
16051605
schema_pointer=model_schema_pointer,
16061606
key_pointer=model_key_pointer,
16071607
type_pointer=model_type_pointer,
1608-
types_map=types_map,
1608+
types_mapping=types_mapping,
16091609
parameters=model.parameters or {},
16101610
)
16111611

airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class SchemaTypeIdentifier:
6464
key_pointer: List[Union[InterpolatedString, str]]
6565
parameters: InitVar[Mapping[str, Any]]
6666
type_pointer: Optional[List[Union[InterpolatedString, str]]] = None
67-
types_map: Optional[List[TypesMap]] = None
67+
types_mapping: Optional[List[TypesMap]] = None
6868
schema_pointer: Optional[List[Union[InterpolatedString, str]]] = None
6969

7070
def __post_init__(self, parameters: Mapping[str, Any]) -> None:
@@ -182,10 +182,10 @@ def _replace_type_if_not_valid(
182182
"""
183183
Replaces a field type if it matches a type mapping in `types_map`.
184184
"""
185-
if self.schema_type_identifier.types_map:
186-
for types_pair in self.schema_type_identifier.types_map:
187-
if field_type == types_pair.current_type:
188-
return types_pair.target_type
185+
if self.schema_type_identifier.types_mapping:
186+
for types_map in self.schema_type_identifier.types_mapping:
187+
if field_type == types_map.current_type:
188+
return types_map.target_type
189189
return field_type
190190

191191
@staticmethod
@@ -212,8 +212,8 @@ def _extract_data(
212212
return body
213213

214214
path = [
215-
path.eval(self.config) if not isinstance(path, str) else path
216-
for path in extraction_path
215+
node.eval(self.config) if not isinstance(node, str) else node
216+
for node in extraction_path
217217
]
218218

219219
return dpath.get(body, path, default=default) # type: ignore # extracted will be a MutableMapping, given input data structure

unit_tests/sources/declarative/schema/test_dynamic_schema_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def mock_schema_type_identifier():
3030
schema_pointer=["schema"],
3131
key_pointer=["key"],
3232
type_pointer=["type"],
33-
types_map=[],
33+
types_mapping=[],
3434
parameters={},
3535
)
3636

0 commit comments

Comments
 (0)