@@ -144,13 +144,11 @@ def __init__(
144
144
# apply additional post-processing to the manifest
145
145
self ._post_process_manifest ()
146
146
147
- self ._config : Mapping [str , Any ]
148
- self ._spec_component : Optional [Spec ]
149
147
spec : Optional [Mapping [str , Any ]] = self ._source_config .get ("spec" )
150
- self ._spec_component = (
148
+ self ._spec_component : Optional [ Spec ] = (
151
149
self ._constructor .create_component (SpecModel , spec , dict ()) if spec else None
152
150
)
153
- self ._config = self ._migrate_and_transform_config (config_path , config )
151
+ self ._config = self ._migrate_and_transform_config (config_path , config ) or {}
154
152
155
153
@property
156
154
def resolved_manifest (self ) -> Mapping [str , Any ]:
@@ -216,23 +214,24 @@ def _migrate_and_transform_config(
216
214
self ,
217
215
config_path : Optional [str ],
218
216
config : Optional [Config ],
219
- ) -> Config :
220
- mutable_config = dict (config ) if config else {}
221
- if self ._spec_component :
222
- self ._spec_component .migrate_config (mutable_config )
223
- if mutable_config != config :
224
- if config_path :
225
- with open (config_path , "w" ) as f :
226
- json .dump (mutable_config , f )
227
- self .message_repository .emit_message (
228
- create_connector_config_control_message (mutable_config )
229
- )
230
- # We have no mechanism for consuming the queue, so we print the messages to stdout
231
- for message in self .message_repository .consume_queue ():
232
- print (orjson .dumps (AirbyteMessageSerializer .dump (message )).decode ())
233
-
234
- self ._spec_component .transform_config (mutable_config )
235
-
217
+ ) -> Optional [Config ]:
218
+ if not config :
219
+ return None
220
+ if not self ._spec_component :
221
+ return config
222
+ mutable_config = dict (config )
223
+ self ._spec_component .migrate_config (mutable_config )
224
+ if mutable_config != config :
225
+ if config_path :
226
+ with open (config_path , "w" ) as f :
227
+ json .dump (mutable_config , f )
228
+ self .message_repository .emit_message (
229
+ create_connector_config_control_message (mutable_config )
230
+ )
231
+ # We have no mechanism for consuming the queue, so we print the messages to stdout
232
+ for message in self .message_repository .consume_queue ():
233
+ print (orjson .dumps (AirbyteMessageSerializer .dump (message )).decode ())
234
+ self ._spec_component .transform_config (mutable_config )
236
235
return mutable_config
237
236
238
237
def _migrate_manifest (self ) -> None :
0 commit comments