Skip to content
Merged
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
16 changes: 16 additions & 0 deletions src/tirith/providers/json/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@


def get_value(provider_args: Dict, input_data: Dict) -> List[dict]:
"""
Extract values from input JSON data based on the specified key path.

:param provider_args: Provider arguments containing `key_path` to look up.
:param input_data: Target input JSON dictionary to extract values from.
:returns: List of result dictionaries with extracted values or an error dictionary.
:raises KeyError: If `key_path` is missing in `provider_args`.
"""
# Must be validated first whether the provider args are valid for this op type
key_path: str = provider_args["key_path"]

Expand All @@ -26,6 +34,14 @@ def get_value(provider_args: Dict, input_data: Dict) -> List[dict]:


def provide(provider_args: Dict, input_data: Dict) -> List[Dict]:
"""
Dispatch and execute the requested JSON provider operation.

:param provider_args: Provider arguments containing `operation_type` and its parameters.
:param input_data: Input JSON data passed to the operation handler.
:returns: List of result dictionaries from the operation or an error dictionary if unsupported.
:raises KeyError: If `operation_type` is missing in `provider_args`.
"""
operation_type = provider_args["operation_type"]

op_handler = SUPPORTED_OPS.get(operation_type)
Expand Down
Loading