fix: removes unecessary check

This commit is contained in:
2025-09-13 19:36:53 -03:00
parent 5eb086bafd
commit c1f04606ad
2 changed files with 4 additions and 8 deletions

View File

@@ -38,7 +38,7 @@ class SchemaConverter:
case "object":
return ObjectTypeParser.to_model(
schema["title"],
schema["properties"],
schema.get("properties", {}),
schema.get("required", []),
context=schema,
ref_cache=dict(),
@@ -58,7 +58,7 @@ class SchemaConverter:
raise TypeError(f"Unsupported schema type: {schema_type}")
@staticmethod
def _get_schema_type(schema: JSONSchema) -> str:
def _get_schema_type(schema: JSONSchema) -> str | None:
"""
Returns the type of the schema.
:param schema: The JSON Schema to check.
@@ -67,8 +67,4 @@ class SchemaConverter:
if "$ref" in schema:
return "$ref"
schema_type = schema.get("type")
if isinstance(schema_type, str):
return schema_type
raise ValueError("Schema must have a valid 'type' or '$ref' field.")
return schema.get("type")

View File

@@ -42,7 +42,7 @@ JSONSchema = TypedDict(
"description": str,
"default": JSONType,
"examples": List[JSONType],
"type": Union[JSONSchemaType, List[JSONSchemaType]],
"type": JSONSchemaType,
"enum": List[JSONType],
"const": JSONType,
"properties": Dict[str, "JSONSchema"],