marvin.utilities.jsonschema
Convert JSON Schema to Python types with validation.
The jsonschema_to_type function converts a JSON Schema into a Python type that can be used
for validation with Pydantic. It supports:
- Basic types (string, number, integer, boolean, null)
- Complex types (arrays, objects)
- Format constraints (date-time, email, uri)
- Numeric constraints (minimum, maximum, multipleOf)
- String constraints (minLength, maxLength, pattern)
- Array constraints (minItems, maxItems, uniqueItems)
- Object properties with defaults
- References and recursive schemas
- Enums and constants
- Union types
Constants
FORMAT_TYPES
Classes
JSONSchema
Functions
create_array_type
create_dataclass
create_enum
create_field_with_default
create_numeric_type
create_string_type
get_default_value
- Value from parent’s default if it exists
- Property’s own default if it exists
- None
hash_schema
jsonschema_to_type
merge_defaults
resolve_ref
sanitize_name
schema_to_type
Parent Module:
utilities