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
2 changes: 1 addition & 1 deletion dlt/sources/rest_api/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class Endpoint(TypedDict, total=False):
headers: Optional[Dict[str, Any]]


class ProcessingSteps(TypedDict):
class ProcessingSteps(TypedDict, total=False):
filter: Optional[Callable[[Any], bool]] # noqa: A003
map: Optional[Callable[[Any], Any]] # noqa: A003

Expand Down
26 changes: 13 additions & 13 deletions tests/sources/rest_api/integration/test_processing_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_rest_api_source_filtered(mock_api_server) -> None:
"name": "posts",
"endpoint": "posts",
"processing_steps": [
{"filter": lambda x: x["id"] == 1}, # type: ignore[typeddict-item]
{"filter": lambda x: x["id"] == 1},
],
},
],
Expand Down Expand Up @@ -56,7 +56,7 @@ def pop_columns(record: Dict[str, Any]) -> Dict[str, Any]:
"endpoint": "posts",
"processing_steps": [
{
"map": exclude_columns(["title"]), # type: ignore[typeddict-item]
"map": exclude_columns(["title"]),
},
],
},
Expand Down Expand Up @@ -88,7 +88,7 @@ def empty_columns(record: Dict[str, Any]) -> Dict[str, Any]:
"endpoint": "posts",
"processing_steps": [
{
"map": anonymize_columns(["title"]), # type: ignore[typeddict-item]
"map": anonymize_columns(["title"]),
},
],
},
Expand All @@ -115,7 +115,7 @@ def lower_title(row):
"name": "posts",
"endpoint": "posts",
"processing_steps": [
{"map": lower_title}, # type: ignore[typeddict-item]
{"map": lower_title},
],
},
],
Expand All @@ -141,16 +141,16 @@ def id_by_10(row):
"name": "posts",
"endpoint": "posts",
"processing_steps": [
{"map": id_by_10}, # type: ignore[typeddict-item]
{"filter": lambda x: x["id"] == 10}, # type: ignore[typeddict-item]
{"map": id_by_10},
{"filter": lambda x: x["id"] == 10},
],
},
{
"name": "posts_2",
"endpoint": "posts",
"processing_steps": [
{"filter": lambda x: x["id"] == 10}, # type: ignore[typeddict-item]
{"map": id_by_10}, # type: ignore[typeddict-item]
{"filter": lambda x: x["id"] == 10},
{"map": id_by_10},
],
},
],
Expand Down Expand Up @@ -193,14 +193,14 @@ def test_rest_api_source_filtered_child(mock_api_server, comments_endpoint) -> N
"name": "posts",
"endpoint": "posts",
"processing_steps": [
{"filter": lambda x: x["id"] in (1, 2)}, # type: ignore[typeddict-item]
{"filter": lambda x: x["id"] in (1, 2)},
],
},
{
"name": "comments",
"endpoint": comments_endpoint,
"processing_steps": [
{"filter": lambda x: x["id"] == 1}, # type: ignore[typeddict-item]
{"filter": lambda x: x["id"] == 1},
],
},
],
Expand Down Expand Up @@ -241,16 +241,16 @@ def extend_body(row):
"name": "posts",
"endpoint": "posts",
"processing_steps": [
{"filter": lambda x: x["id"] in (1, 2)}, # type: ignore[typeddict-item]
{"filter": lambda x: x["id"] in (1, 2)},
],
},
{
"name": "comments",
"endpoint": comments_endpoint,
"include_from_parent": ["title"],
"processing_steps": [
{"map": extend_body}, # type: ignore[typeddict-item]
{"filter": lambda x: x["body"].startswith("Post 2")}, # type: ignore[typeddict-item]
{"map": extend_body},
{"filter": lambda x: x["body"].startswith("Post 2")},
],
},
],
Expand Down