Skip to content

Commit 4e2e8fc

Browse files
committed
revert to include spec/spec_component check
1 parent f8199e1 commit 4e2e8fc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

airbyte_cdk/sources/declarative/manifest_declarative_source.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,15 @@ def __init__(
145145
self._post_process_manifest()
146146

147147
self._config: Mapping[str, Any]
148-
self._spec_component: Spec
149-
spec: Mapping[str, Any] = self._source_config["spec"]
150-
self._spec_component = self._constructor.create_component(SpecModel, spec, dict())
148+
self._spec_component: Optional[Spec]
149+
spec: Optional[Mapping[str, Any]] = self._source_config.get("spec")
150+
self._spec_component = (
151+
self._constructor.create_component(SpecModel, spec, dict()) if spec else None
152+
)
151153
mutable_config = dict(config) if config else {}
152154
self._migrate_config(config_path, mutable_config, config)
153-
self._spec_component.transform_config(mutable_config)
155+
if self._spec_component:
156+
self._spec_component.transform_config(mutable_config)
154157
self._config = mutable_config
155158

156159
@property
@@ -219,7 +222,7 @@ def _migrate_config(
219222
mutable_config: MutableMapping[str, Any],
220223
config: Optional[Mapping[str, Any]],
221224
) -> None:
222-
if config_path and config:
225+
if config_path and config and self._spec_component:
223226
self._spec_component.migrate_config(mutable_config)
224227
if mutable_config != config:
225228
if config_path:

0 commit comments

Comments
 (0)