Skip to content

Commit

Permalink
Changed helpers var name in _extract_data and typo in schema loader
Browse files Browse the repository at this point in the history
  • Loading branch information
lazebnyi committed Dec 5, 2024
1 parent 05e4f74 commit d41f54c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1585,12 +1585,12 @@ def create_types_map(model: TypesMapModel, **kwargs: Any) -> TypesMap:
def create_schema_type_identifier(
self, model: SchemaTypeIdentifierModel, config: Config, **kwargs: Any
) -> SchemaTypeIdentifier:
types_map = []
types_mapping = []
if model.types_mapping:
types_map.extend(
types_mapping.extend(
[
self._create_component_from_model(types_pair, config=config)
for types_pair in model.types_mapping
self._create_component_from_model(types_map, config=config)
for types_map in model.types_mapping
]
)
model_schema_pointer: List[Union[InterpolatedString, str]] = (
Expand All @@ -1605,7 +1605,7 @@ def create_schema_type_identifier(
schema_pointer=model_schema_pointer,
key_pointer=model_key_pointer,
type_pointer=model_type_pointer,
types_map=types_map,
types_mapping=types_mapping,
parameters=model.parameters or {},
)

Expand Down
14 changes: 7 additions & 7 deletions airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SchemaTypeIdentifier:
key_pointer: List[Union[InterpolatedString, str]]
parameters: InitVar[Mapping[str, Any]]
type_pointer: Optional[List[Union[InterpolatedString, str]]] = None
types_map: Optional[List[TypesMap]] = None
types_mapping: Optional[List[TypesMap]] = None
schema_pointer: Optional[List[Union[InterpolatedString, str]]] = None

def __post_init__(self, parameters: Mapping[str, Any]) -> None:
Expand Down Expand Up @@ -182,10 +182,10 @@ def _replace_type_if_not_valid(
"""
Replaces a field type if it matches a type mapping in `types_map`.
"""
if self.schema_type_identifier.types_map:
for types_pair in self.schema_type_identifier.types_map:
if field_type == types_pair.current_type:
return types_pair.target_type
if self.schema_type_identifier.types_mapping:
for types_map in self.schema_type_identifier.types_mapping:
if field_type == types_map.current_type:
return types_map.target_type
return field_type

@staticmethod
Expand All @@ -212,8 +212,8 @@ def _extract_data(
return body

path = [
path.eval(self.config) if not isinstance(path, str) else path
for path in extraction_path
node.eval(self.config) if not isinstance(node, str) else node
for node in extraction_path
]

return dpath.get(body, path, default=default) # type: ignore # extracted will be a MutableMapping, given input data structure
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def mock_schema_type_identifier():
schema_pointer=["schema"],
key_pointer=["key"],
type_pointer=["type"],
types_map=[],
types_mapping=[],
parameters={},
)

Expand Down

0 comments on commit d41f54c

Please sign in to comment.