Fixes Typing Output #15

Merged
HideyoshiNakazone merged 1 commits from fix/better-typing-output into main 2025-06-02 23:43:13 +00:00
Showing only changes of commit 9e52783b22 - Show all commits

View File

@@ -18,7 +18,7 @@ class SchemaConverter:
""" """
@staticmethod @staticmethod
def build(schema: JSONSchema) -> ModelT: def build(schema: JSONSchema) -> type[ModelT]:
""" """
Converts a JSON Schema to a Pydantic model. Converts a JSON Schema to a Pydantic model.
:param schema: The JSON Schema to convert. :param schema: The JSON Schema to convert.
@@ -33,7 +33,7 @@ class SchemaConverter:
def build_object( def build_object(
name: str, name: str,
schema: JSONSchema, schema: JSONSchema,
) -> ModelT: ) -> type[ModelT]:
""" """
Converts a JSON Schema object to a Pydantic model given a name. Converts a JSON Schema object to a Pydantic model given a name.
:param name: :param name:
@@ -59,7 +59,7 @@ class SchemaConverter:
@staticmethod @staticmethod
def _build_model_from_properties( def _build_model_from_properties(
model_name: str, model_properties: dict, required_keys: list[str] model_name: str, model_properties: dict, required_keys: list[str]
) -> ModelT: ) -> type[ModelT]:
properties = SchemaConverter._parse_properties(model_properties, required_keys) properties = SchemaConverter._parse_properties(model_properties, required_keys)
return create_model(model_name, **properties) return create_model(model_name, **properties)