Skip to content

Commit

Permalink
add support for swagger object type (langgenius#3426)
Browse files Browse the repository at this point in the history
Co-authored-by: lipeikui <lipeikui@3vjia.com>
  • Loading branch information
LeePui and lipeikui authored Apr 16, 2024
1 parent 066076b commit 38ca3b2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/core/tools/tool/api_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ def _convert_body_property_type(self, property: dict[str, Any], value: Any) -> A
elif property['type'] == 'null':
if value is None:
return None
elif property['type'] == 'object':
if isinstance(value, str):
try:
return json.loads(value)
except ValueError:
return value
elif isinstance(value, dict):
return value
else:
return value
else:
raise ValueError(f"Invalid type {property['type']} for property {property}")
elif 'anyOf' in property and isinstance(property['anyOf'], list):
Expand Down

0 comments on commit 38ca3b2

Please sign in to comment.