@@ -105,16 +105,11 @@ def __init__(
105105 self .logger = logging .getLogger (f"airbyte.{ self .name } " )
106106 self ._should_normalize = normalize_manifest
107107 self ._declarative_component_schema = _get_declarative_component_schema ()
108- # For ease of use we don't require the type to be specified at the top level manifest, but it should be included during processing
109- manifest = dict (source_config )
110- self ._fix_source_type (manifest )
111108 # If custom components are needed, locate and/or register them.
112109 self .components_module : ModuleType | None = get_registered_components_module (config = config )
113- # resolve all `$ref` references in the manifest
114- self ._preprocess_manifest (manifest )
115110 # resolve all components in the manifest
116- self ._propagate_types_and_parameters ( manifest )
117- self . _source_config = manifest
111+ self ._source_config = self . _preprocess_manifest ( dict ( source_config ) )
112+
118113 self ._debug = debug
119114 self ._emit_connector_builder_messages = emit_connector_builder_messages
120115 self ._constructor = (
@@ -130,10 +125,12 @@ def __init__(
130125 AlwaysLogSliceLogger () if emit_connector_builder_messages else DebugSliceLogger ()
131126 )
132127 self ._config = config or {}
128+
133129 # validate resolved manifest against the declarative component schema
134130 self ._validate_source ()
131+
135132 # apply additional post-processing to the manifest
136- self ._normalize_manifest ()
133+ self ._postprocess_manifest ()
137134
138135 @property
139136 def resolved_manifest (self ) -> Mapping [str , Any ]:
@@ -148,7 +145,7 @@ def resolved_manifest(self) -> Mapping[str, Any]:
148145 """
149146 return self ._source_config
150147
151- def _preprocess_manifest (self , manifest : Dict [str , Any ]) -> None :
148+ def _preprocess_manifest (self , manifest : Dict [str , Any ]) -> Dict [ str , Any ] :
152149 """
153150 Preprocesses the provided manifest dictionary by resolving any manifest references.
154151
@@ -161,22 +158,25 @@ def _preprocess_manifest(self, manifest: Dict[str, Any]) -> None:
161158 Returns:
162159 None
163160 """
164- ManifestReferenceResolver (). preprocess_manifest ( manifest )
165-
166- def _propagate_types_and_parameters ( self , manifest : Dict [ str , Any ]) -> None :
167- """
168- Propagates types and parameters throughout the provided manifest.
169-
170- This method utilizes the ManifestComponentTransformer to traverse and update the manifest dictionary,
171- ensuring that types and parameters are correctly propagated from the root to all nested components.
161+ # For ease of use we don't require the type to be specified at the top level manifest, but it should be included during processing
162+ manifest = self . _fix_source_type ( manifest )
163+ # Resolve references in the manifest
164+ resolved_manifest = ManifestReferenceResolver (). preprocess_manifest ( manifest )
165+ # Propagate types and parameters throughout the manifest
166+ propagated_manifest = ManifestComponentTransformer (). propagate_types_and_parameters (
167+ "" , resolved_manifest , {}
168+ )
172169
173- Args:
174- manifest (Dict[str, Any]): The manifest dictionary to update with propagated types and parameters.
170+ return propagated_manifest
175171
176- Returns:
177- None
172+ def _postprocess_manifest (self ) -> None :
173+ """
174+ Post-processes the manifest after validation.
175+ This method is responsible for any additional modifications or transformations needed
176+ after the manifest has been validated and before it is used in the source.
178177 """
179- ManifestComponentTransformer ().propagate_types_and_parameters ("" , manifest , {})
178+ # apply manifest normalization, if required
179+ self ._normalize_manifest ()
180180
181181 def _normalize_manifest (self ) -> None :
182182 """
@@ -190,13 +190,15 @@ def _normalize_manifest(self) -> None:
190190 normalizer = ManifestNormalizer (self ._source_config , self ._declarative_component_schema )
191191 self ._source_config = normalizer .normalize ()
192192
193- def _fix_source_type (self , manifest : Dict [str , Any ]) -> None :
193+ def _fix_source_type (self , manifest : Dict [str , Any ]) -> Dict [ str , Any ] :
194194 """
195195 Fix the source type in the manifest. This is necessary because the source type is not always set in the manifest.
196196 """
197197 if "type" not in manifest :
198198 manifest ["type" ] = "DeclarativeSource"
199199
200+ return manifest
201+
200202 @property
201203 def message_repository (self ) -> MessageRepository :
202204 return self ._message_repository
0 commit comments