package jsonschema
JSON Schema validator for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
jsonschema-0.1.0.tbz
sha256=21a3ff475202fe598f639c4dc5b03355f169d9d77b4f17ecd5a1aca9b475b93e
sha512=ce90853ca15dfe5e52289f4fb5ce92275dcde931114312f77fd6e817c0727708ebb006546a6b5ce05332a9c1a49c07d7c6a8131e54a02085cc999a6d823a06e8
doc/jsonschema/Jsonschema/index.html
Module Jsonschema
Source
JSON Schema validator supporting drafts 4, 6, 7, 2019-09, and 2020-12
Core Types
Supported draft versions
A compiled JSON schema
Instance location token
Instance location in the validated document
Set of JSON types
Source
type error_kind =
| Group
| Schema of {
}
| Content_schema
| Property_name of {
}
| Reference of {
}
| Ref_cycle of {
}
| False_schema
| Type of {
got : Yojson.Basic.t;
want : type_set;
}
| Enum of {
want : Yojson.Basic.t list;
}
| Const of {
want : Yojson.Basic.t;
}
| Format of {
got : Yojson.Basic.t;
want : string;
err : exn;
}
| Min_properties of {
}
| Max_properties of {
}
| Additional_properties of {
}
| Unevaluated_properties of {
}
| Unevaluated_items of {
}
| Required of {
}
| Dependency of {
}
| Dependent_required of {
}
| Min_items of {
}
| Max_items of {
}
| Contains
| Min_contains of {
}
| Max_contains of {
}
| Unique_items of {
}
| Additional_items of {
}
| Min_length of {
}
| Max_length of {
}
| Pattern of {
}
| Content_encoding of {
}
| Content_media_type of {
}
| Minimum of {
}
| Maximum of {
}
| Exclusive_minimum of {
}
| Exclusive_maximum of {
}
| Multiple_of of {
}
| Not
| All_of
| Any_of
| One_of of (int * int) option
Validation error kinds
Source
type validation_error = {
schema_url : string;
instance_location : instance_location;
kind : error_kind;
causes : validation_error list;
}
Validation error
Source
type compile_error =
| Parse_url_error of {
}
| Load_url_error of {
}
| Unsupported_url_scheme of {
}
| Invalid_meta_schema_url of {
}
| Unsupported_draft of {
}
| MetaSchema_cycle of {
}
| Validation_error of {
url : string;
src : validation_error;
}
| Parse_id_error of {
}
| Parse_anchor_error of {
}
| Duplicate_id of {
}
| Duplicate_anchor of {
}
| Invalid_json_pointer of string
| Json_pointer_not_found of string
| Anchor_not_found of {
}
| Unsupported_vocabulary of {
}
| Invalid_regex of {
}
| Bug of exn
Compilation errors
JSON pointer for navigating JSON documents
High-Level API
A reusable validator
Source
val validate_file :
?draft:draft ->
schema:string ->
Yojson.Basic.t ->
(unit, validation_error) result
Validate JSON against a schema from a file/URL
Source
val validate_strings :
?draft:draft ->
schema:string ->
json:string ->
unit ->
(unit, validation_error) result
Validate JSON string against schema string
Source
val create_validator :
?draft:draft ->
?enable_format_assertions:bool ->
?enable_content_assertions:bool ->
string ->
(validator, compile_error) result
Create a reusable validator for efficiency
Validate using a pre-compiled validator
Source
val create_validator_with_loader :
?draft:draft ->
?enable_format_assertions:bool ->
?enable_content_assertions:bool ->
url_loader:Loader.url_loader ->
schema:Yojson.Basic.t ->
unit ->
(validator, compile_error) result
Create a validator with a custom URL loader for remote refs
Source
val create_validator_from_json :
?draft:draft ->
?enable_format_assertions:bool ->
?enable_content_assertions:bool ->
schema:Yojson.Basic.t ->
unit ->
(validator, compile_error) result
Create a validator from JSON schema (for testing)
Low-Level API
Compilation
Schema Operations
Types
Output Formats
Format Validation
Content Validation
URL Loading
Utilities
Pretty Printing
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page