package mcp-kit
Module Jsonschema_core.CompilerSource
Schema compiler — transforms JSON Schema into a validator function.
The compiler dispatches to registered keyword compilers and handles boolean schemas, $ref resolution, and unknown keyword skipping.
Keyword compilers are provided by vocabulary packages (e.g., jsonschema-validation) and registered before compilation.
type config = {keywords : keyword_compiler list;format_assertion : bool;id_keyword : string;allow_boolean_schemas : bool;ref_siblings_apply : bool;recursive_ref_enabled : bool;recursive_ref_target : Uri.t option;dynamic_ref_enabled : bool;dynamic_ref_targets : (string * Uri.t) list;select_config : config -> Yojson.Safe.t -> config;
}Configuration for compilation.
and keyword_compiler = {keyword : string;compile : context -> Yojson.Safe.t -> Registry.validator option;
}A keyword compiler: given context and the keyword's value, returns a validator or None if the keyword is not applicable.
and context = {config : config;registry : Registry.t;base_uri : Uri.t;schema_path : Json_pointer.t;schema_obj : Yojson.Safe.t;compile_sub : ?schema_path:Json_pointer.t -> Yojson.Safe.t -> Registry.validator;
}Context passed to keyword compilers.
val compile :
config ->
Registry.t ->
?base_uri:Uri.t ->
?schema_path:Json_pointer.t ->
Yojson.Safe.t ->
Registry.validatorCompile a JSON Schema into a validator.
The schema is compiled against the given registry, using the provided keyword compilers. Boolean schemas are handled directly. $ref handling depends on the draft profile: older drafts ignore sibling keywords, while Draft 2019-09 and later apply them alongside $ref.