From c1f04606ad1955bb5392ba380977aefbe9bfd264 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sat, 13 Sep 2025 19:36:53 -0300 Subject: [PATCH] fix: removes unecessary check --- jambo/schema_converter.py | 10 +++------- jambo/types/json_schema_type.py | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/jambo/schema_converter.py b/jambo/schema_converter.py index da89d21..1624940 100644 --- a/jambo/schema_converter.py +++ b/jambo/schema_converter.py @@ -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") diff --git a/jambo/types/json_schema_type.py b/jambo/types/json_schema_type.py index dcb0951..954db75 100644 --- a/jambo/types/json_schema_type.py +++ b/jambo/types/json_schema_type.py @@ -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"],