Formatron v0.4.9
Formatron empowers everyone to control the output format of language models with minimal overhead.
Loading...
Searching...
No Matches
json_schema.py File Reference

Go to the source code of this file.

Classes

class  formatron.schemas.json_schema.FieldInfo
 

Namespaces

namespace  formatron
 
namespace  formatron.schemas
 This subpackage contains modules that define schemas creation from various sources.
 
namespace  formatron.schemas.json_schema
 This module contains utilities for creating schemas from JSON schemas.
 

Functions

schemas.schema.Schema formatron.schemas.json_schema.create_schema (dict[str, typing.Any] schema, registry=Registry())
 Create a Schema object from a JSON schema object.
 
str formatron.schemas.json_schema._resolve_new_url (str uri, str ref)
 Adapted from https://github.com/python-jsonschema/referencing/blob/main/referencing/_core.py#L667.
 
None formatron.schemas.json_schema._validate_json_schema (dict[str, typing.Any] schema)
 
typing.Type formatron.schemas.json_schema._convert_json_schema_to_our_schema (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Recursively handle all types needed to fully determine the type of a schema.
 
 formatron.schemas.json_schema._extract_fields_from_object_type (typing.Type object_type)
 
typing.Type formatron.schemas.json_schema._handle_anyOf (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 
typing.Type[typing.Any|None] formatron.schemas.json_schema._infer_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Infer more specific types.
 
typing.Any formatron.schemas.json_schema._get_literal (dict[str, typing.Any] schema)
 
typing.Type formatron.schemas.json_schema._handle_literal (typing.Any literal, typing.Type obtained_type, dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 
typing.Type formatron.schemas.json_schema._handle_str_with_metadata (dict[str, typing.Any] schema)
 Handle string type with metadata such as maxLength, minLength, and pattern.
 
typing.Type formatron.schemas.json_schema._handle_numeric_with_metadata (dict[str, typing.Any] schema, typing.Type numeric_type)
 Handle numeric types (int or float) with metadata such as minimum, maximum, exclusiveMinimum, and exclusiveMaximum.
 
typing.Type formatron.schemas.json_schema._create_custom_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 
typing.Type formatron.schemas.json_schema._handle_list_metadata (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Handle cases where the obtained type is a list.
 
typing.Type[typing.Any|None] formatron.schemas.json_schema._obtain_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Directly obtain type information from this schema's type keyword.
 
 formatron.schemas.json_schema._merge_referenced_schema (dict[str, typing.Any] schema, set[int] memo)
 
 formatron.schemas.json_schema._merge_key (dict[str, typing.Any] schema, str ref_key, typing.Any reference_value)
 
 formatron.schemas.json_schema._recursive_resolve_reference (str base_uri, typing.Any schema, Registry registry, set[int] memo)
 
 formatron.schemas.json_schema._resolve_reference (dict[str, typing.Any] schema, str key, typing.Any resolver)
 

Variables

int formatron.schemas.json_schema._counter