Convenience API to build a valid JSON schema
Create schema builder with blank schema
Create boolean schema
Extract JSON Schema from the builder
JSON Schema spec allows type to be string or array of strings. There are three
groups of types produced: single types (e.g. "string"), nullable types (e.g. ["string", "null"])
and union types (e.g. ["string", "object"])
Set the type property of JSON schema to a specific type, accepts strings
buildSchema
|> withType "boolean"Set the type property of JSON schema to a nullable type.
buildSchema
|> withNullableType "string"Set the type property of JSON schema to an union type.
buildSchema
|> withUnionType [ "string", "object" ]The following validations are only applicable to numeric values and
will always succeed for any type other than number and integer
Set the contains property of JSON schema to a sub-schema.
buildSchema
|> withContains
(buildSchema
|> withType "string"
)Validate value using schema controlled by builder.
Builder for JSON schema providing an API like this: