Fix(classgen): support number conversion from jsonschema
This commit is contained in:
@@ -34,6 +34,10 @@ def map_json_type(
|
|||||||
return {"int"}
|
return {"int"}
|
||||||
if json_type == "boolean":
|
if json_type == "boolean":
|
||||||
return {"bool"}
|
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":
|
if json_type == "array":
|
||||||
assert nested_types, f"Array type not found for {parent}"
|
assert nested_types, f"Array type not found for {parent}"
|
||||||
return {f"""list[{" | ".join(nested_types)}]"""}
|
return {f"""list[{" | ".join(nested_types)}]"""}
|
||||||
|
|||||||
Reference in New Issue
Block a user