Skip to content

Commit 7490ad1

Browse files
style: fix formatting issues
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent cdd1ac9 commit 7490ad1

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

airbyte_cdk/sources/declarative/manifest_declarative_source.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
class ManifestDeclarativeSource(DeclarativeSource):
6161
"""Declarative source defined by a manifest of low-code components that define source connector behavior
62-
62+
6363
If any stream in the source uses a DynamicSchemaLoader, config validation will be skipped during
6464
discovery. This allows sources with dynamic schemas to run discovery without requiring authentication
6565
when the schema endpoint doesn't need auth to provide catalog information.
@@ -113,7 +113,7 @@ def __init__(
113113

114114
self._config = config or {}
115115
self._validate_source()
116-
116+
117117
self.check_config_against_spec = not self._uses_dynamic_schema_loader()
118118

119119
@property
@@ -447,29 +447,35 @@ def _dynamic_stream_configs(
447447

448448
def _emit_manifest_debug_message(self, extra_args: dict[str, Any]) -> None:
449449
self.logger.debug("declarative source created from manifest", extra=extra_args)
450-
450+
451451
def _uses_dynamic_schema_loader(self) -> bool:
452452
"""
453453
Determines if any stream in the source uses a DynamicSchemaLoader.
454-
454+
455455
DynamicSchemaLoader makes a separate call to retrieve schema information,
456456
which might not require authentication, so we can skip config validation
457457
during discovery when it's used.
458-
458+
459459
Returns:
460460
bool: True if any stream uses a DynamicSchemaLoader, False otherwise.
461461
"""
462462
for stream_config in self._stream_configs(self._source_config):
463463
schema_loader = stream_config.get("schema_loader", {})
464-
if isinstance(schema_loader, dict) and schema_loader.get("type") == "DynamicSchemaLoader":
464+
if (
465+
isinstance(schema_loader, dict)
466+
and schema_loader.get("type") == "DynamicSchemaLoader"
467+
):
465468
return True
466-
469+
467470
dynamic_streams = self._source_config.get("dynamic_streams", [])
468471
if dynamic_streams:
469472
for dynamic_stream in dynamic_streams:
470473
stream_template = dynamic_stream.get("stream_template", {})
471474
schema_loader = stream_template.get("schema_loader", {})
472-
if isinstance(schema_loader, dict) and schema_loader.get("type") == "DynamicSchemaLoader":
475+
if (
476+
isinstance(schema_loader, dict)
477+
and schema_loader.get("type") == "DynamicSchemaLoader"
478+
):
473479
return True
474-
480+
475481
return False

unit_tests/sources/declarative/test_manifest_declarative_source_dynamic_schema.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ def test_check_config_against_spec_with_dynamic_schema_loader():
2525
},
2626
"schema_type_identifier": {
2727
"key_pointer": ["name"],
28-
}
28+
},
2929
},
3030
"retriever": {
3131
"type": "SimpleRetriever",
3232
"requester": {"url_base": "https://example.com", "http_method": "GET"},
3333
"record_selector": {"extractor": {"field_path": []}},
34-
}
34+
},
3535
}
3636
],
37-
"version": "0.1.0"
37+
"version": "0.1.0",
3838
}
39-
39+
4040
source = ManifestDeclarativeSource(source_config=source_config)
41-
41+
4242
assert source.check_config_against_spec is False
4343

4444

@@ -50,20 +50,17 @@ def test_check_config_against_spec_without_dynamic_schema_loader():
5050
"streams": [
5151
{
5252
"name": "test_stream",
53-
"schema_loader": {
54-
"type": "InlineSchemaLoader",
55-
"schema": {}
56-
},
53+
"schema_loader": {"type": "InlineSchemaLoader", "schema": {}},
5754
"retriever": {
5855
"type": "SimpleRetriever",
5956
"requester": {"url_base": "https://example.com", "http_method": "GET"},
6057
"record_selector": {"extractor": {"field_path": []}},
61-
}
58+
},
6259
}
6360
],
64-
"version": "0.1.0"
61+
"version": "0.1.0",
6562
}
66-
63+
6764
source = ManifestDeclarativeSource(source_config=source_config)
68-
65+
6966
assert source.check_config_against_spec is True

0 commit comments

Comments
 (0)