Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions connector_builder_mcp/validation_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,16 @@ def run_connector_readiness_test_report( # noqa: PLR0912, PLR0914, PLR0915 (too
if isinstance(streams, str):
stream_names = [s.strip() for s in streams.split(",") if s.strip()]
else:
if available_streams:
invalid_streams = [s for s in available_streams if not isinstance(s, dict)]
if invalid_streams:
raise ValueError(
f"Invalid manifest structure: 'streams' must be a list of stream definition objects (dicts), "
f"but found {len(invalid_streams)} invalid entry(ies). "
f"Each stream should be an object with at least a 'name' field and stream configuration. "
f"Invalid entries: {invalid_streams[:3]}"
)

stream_names = [
stream.get("name", f"stream_{i}") for i, stream in enumerate(available_streams)
]
Expand Down
26 changes: 26 additions & 0 deletions tests/integration/test_validation_and_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,32 @@ def test_simple_api_manifest_workflow(simple_api_manifest_yaml) -> None:
assert "streams" in resolved_manifest


def test_malformed_manifest_streams_validation() -> None:
"""Test that malformed manifest with streams as list of strings raises clear error."""
malformed_manifest = """
version: 4.6.2
type: DeclarativeSource
check:
type: CheckStream
stream_names:
- test_stream
streams:
- test_stream
- another_stream
spec:
type: Spec
connection_specification:
type: object
properties: {}
"""

with pytest.raises(
ValueError,
match=r"Invalid manifest structure.*streams.*must be a list of stream definition objects",
):
run_connector_readiness_test_report(manifest=malformed_manifest, config={}, max_records=5)


@pytest.mark.parametrize(
"manifest_fixture,stream_name",
[
Expand Down
Loading