Skip to content

Commit

Permalink
fix: list type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-v4s committed Sep 5, 2024
1 parent de875b8 commit 600d407
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions qualibrate_runner/core/types_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,18 @@ def types_conversion(value: Any, expected_type: Mapping[str, Any]) -> Any:
expected_type_["type"] = expected_type_.pop("anyOf")[0]["type"]
return types_conversion(value, expected_type_)
if "type" in expected_type:
if expected_type.get("type") == "array" and "items" in expected_type:
if expected_type.get("type") == "array":
# array
item_type: Optional[Type[BASIC_TYPES]] = STR_TO_TYPE.get(
expected_type["items"]["type"]
item_type: Optional[Type[BASIC_TYPES]] = (
STR_TO_TYPE.get(expected_type["items"]["type"])
if "items" in expected_type
else None
)
return parse_list(value, item_type)
if expected_type.get("type") in STR_TO_TYPE.keys():
expected = STR_TO_TYPE[expected_type["type"]]
parser = BASIC_PARSERS[expected]
return parser(value)

return value


Expand Down

0 comments on commit 600d407

Please sign in to comment.