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
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ def _dynamic_stream_configs(
# Ensure that each stream is created with a unique name
name = dynamic_stream.get("name")

if not isinstance(name, str):
raise ValueError(
f"Expected stream name {name} to be a string, got {type(name)}."
)

if name in seen_dynamic_streams:
error_message = f"Dynamic streams list contains a duplicate name: {name}. Please contact Airbyte Support."
failure_type = FailureType.system_error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

import json
from copy import deepcopy
from unittest.mock import MagicMock

import pytest
Expand Down Expand Up @@ -362,6 +363,34 @@ def test_http_components_resolver(
assert result == expected_result


def test_wrong_stream_name_type():
with HttpMocker() as http_mocker:
http_mocker.get(
HttpRequest(url="https://api.test.com/int_items"),
HttpResponse(
body=json.dumps(
[
{"id": 1, "name": 1},
{"id": 2, "name": 2},
]
)
),
)

manifest = deepcopy(_MANIFEST)
manifest["dynamic_streams"][0]["components_resolver"]["retriever"]["requester"]["path"] = (
"int_items"
)

source = ConcurrentDeclarativeSource(
source_config=manifest, config=_CONFIG, catalog=None, state=None
)
with pytest.raises(ValueError) as exc_info:
source.discover(logger=source.logger, config=_CONFIG)

assert str(exc_info.value) == "Expected stream name 1 to be a string, got <class 'int'>."


@pytest.mark.parametrize(
"components_mapping, retriever_data, stream_template_config, expected_result",
[
Expand Down
Loading