package mcp-kit

  1. Overview
  2. Docs

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.

Sourcetype config = {
  1. keywords : keyword_compiler list;
  2. format_assertion : bool;
  3. id_keyword : string;
  4. allow_boolean_schemas : bool;
  5. ref_siblings_apply : bool;
  6. recursive_ref_enabled : bool;
  7. recursive_ref_target : Uri.t option;
  8. dynamic_ref_enabled : bool;
  9. dynamic_ref_targets : (string * Uri.t) list;
  10. select_config : config -> Yojson.Safe.t -> config;
}

Configuration for compilation.

Sourceand keyword_compiler = {
  1. keyword : string;
  2. 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.

Sourceand context = {
  1. config : config;
  2. registry : Registry.t;
  3. base_uri : Uri.t;
  4. schema_path : Json_pointer.t;
  5. schema_obj : Yojson.Safe.t;
  6. compile_sub : ?schema_path:Json_pointer.t -> Yojson.Safe.t -> Registry.validator;
}

Context passed to keyword compilers.

Sourceval default_config : config

Default config with no keywords.

Sourceval compile : config -> Registry.t -> ?base_uri:Uri.t -> ?schema_path:Json_pointer.t -> Yojson.Safe.t -> Registry.validator

Compile 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.