Merge pull request 'Fix(classgen): support number conversion from jsonschema' (#3119) from hsjobeki/clan-core:class-fix into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3119
This commit is contained in:
@@ -34,6 +34,10 @@ def map_json_type(
|
||||
return {"int"}
|
||||
if json_type == "boolean":
|
||||
return {"bool"}
|
||||
# In Python, "number" is analogous to the float type.
|
||||
# https://json-schema.org/understanding-json-schema/reference/numeric#number
|
||||
if json_type == "number":
|
||||
return {"float"}
|
||||
if json_type == "array":
|
||||
assert nested_types, f"Array type not found for {parent}"
|
||||
return {f"""list[{" | ".join(nested_types)}]"""}
|
||||
|
||||
Reference in New Issue
Block a user