Skip to content

Commit c251f42

Browse files
committed
Merge branch 'pnilan/feat/implement-validators' into pnilan/feat/extend-spec-class-for-config-migrations
2 parents 4e6ed3b + 833d9e7 commit c251f42

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

airbyte_cdk/sources/declarative/transformations/config_transformations/config_transformation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
from abc import ABC, abstractmethod
6-
from typing import Any, Dict
6+
from typing import Any, MutableMapping
77

88

99
class ConfigTransformation(ABC):
@@ -14,7 +14,7 @@ class ConfigTransformation(ABC):
1414
@abstractmethod
1515
def transform(
1616
self,
17-
config: Dict[str, Any],
17+
config: MutableMapping[str, Any],
1818
) -> None:
1919
"""
2020
Transform a configuration by adding, deleting, or mutating fields directly from the config reference passed in argument.

airbyte_cdk/sources/declarative/transformations/config_transformations/remap_field.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __post_init__(self) -> None:
3434
self._field_path[path_index] = InterpolatedString.create(
3535
self.field_path[path_index], parameters={}
3636
)
37-
self._map = InterpolatedMapping(self.map, parameters={}).eval(config=self.config)
37+
self._map = InterpolatedMapping(self.map, parameters={})
3838

3939
def transform(
4040
self,
@@ -60,5 +60,7 @@ def transform(
6060

6161
field_name = path_components[-1]
6262

63-
if field_name in current and current[field_name] in self._map:
64-
current[field_name] = self._map[current[field_name]]
63+
mapping = self._map.eval(config=self.config)
64+
65+
if field_name in current and current[field_name] in mapping:
66+
current[field_name] = mapping[current[field_name]]

0 commit comments

Comments
 (0)