fix: removes unecessary check
This commit is contained in:
@@ -38,7 +38,7 @@ class SchemaConverter:
|
|||||||
case "object":
|
case "object":
|
||||||
return ObjectTypeParser.to_model(
|
return ObjectTypeParser.to_model(
|
||||||
schema["title"],
|
schema["title"],
|
||||||
schema["properties"],
|
schema.get("properties", {}),
|
||||||
schema.get("required", []),
|
schema.get("required", []),
|
||||||
context=schema,
|
context=schema,
|
||||||
ref_cache=dict(),
|
ref_cache=dict(),
|
||||||
@@ -58,7 +58,7 @@ class SchemaConverter:
|
|||||||
raise TypeError(f"Unsupported schema type: {schema_type}")
|
raise TypeError(f"Unsupported schema type: {schema_type}")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_schema_type(schema: JSONSchema) -> str:
|
def _get_schema_type(schema: JSONSchema) -> str | None:
|
||||||
"""
|
"""
|
||||||
Returns the type of the schema.
|
Returns the type of the schema.
|
||||||
:param schema: The JSON Schema to check.
|
:param schema: The JSON Schema to check.
|
||||||
@@ -67,8 +67,4 @@ class SchemaConverter:
|
|||||||
if "$ref" in schema:
|
if "$ref" in schema:
|
||||||
return "$ref"
|
return "$ref"
|
||||||
|
|
||||||
schema_type = schema.get("type")
|
return schema.get("type")
|
||||||
if isinstance(schema_type, str):
|
|
||||||
return schema_type
|
|
||||||
|
|
||||||
raise ValueError("Schema must have a valid 'type' or '$ref' field.")
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ JSONSchema = TypedDict(
|
|||||||
"description": str,
|
"description": str,
|
||||||
"default": JSONType,
|
"default": JSONType,
|
||||||
"examples": List[JSONType],
|
"examples": List[JSONType],
|
||||||
"type": Union[JSONSchemaType, List[JSONSchemaType]],
|
"type": JSONSchemaType,
|
||||||
"enum": List[JSONType],
|
"enum": List[JSONType],
|
||||||
"const": JSONType,
|
"const": JSONType,
|
||||||
"properties": Dict[str, "JSONSchema"],
|
"properties": Dict[str, "JSONSchema"],
|
||||||
|
|||||||
Reference in New Issue
Block a user