Skip to content

Commit

Permalink
Validate respojnse path
Browse files Browse the repository at this point in the history
  • Loading branch information
davidesner committed May 28, 2024
1 parent 4fe29d3 commit c723405
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python-sync-actions/src/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ def _parse_data(self, data, path) -> list:
value = value[key]
result = value
except KeyError:
raise UserException(f"Path {path.path} not found in the response data")
return [f"Path {path.path} not found in the response data"]

# TODO: check if the result is list
# if not isinstance(result, list):
# element_name = 'root' if path.path == '.' else path.path
# raise UserException(f"The {element_name} element of the response is not list, "
# "please change your Record Selector path to list")
if not isinstance(result, list):
element_name = 'root' if path.path == '.' else path.path
return [f"The {element_name} element of the response is not a list, "
f"please change your Data Selector path to list"]

return result

Expand Down

0 comments on commit c723405

Please sign in to comment.