## Functions
ArraySchemaRepresents a ArraySchema.
FluentSchemaThis keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. If "items" is a schema, validation succeeds if all elements in the array successfully validate against that schema. If "items" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same position, if any. Omitting this keyword has the same behavior as an empty schema.
FluentSchemaThis keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
FluentSchemaAn array instance is valid against "contains" if at least one of its elements is valid against the given schema.
FluentSchemaIf this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique. Omitting this keyword has the same behavior as a value of false.
FluentSchemaAn array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0.
FluentSchemaAn array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0.
BaseSchemaRepresents a BaseSchema.
BaseSchemaIt defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.
BaseSchemaIt can be used to decorate a user interface with information about the data produced by this user interface. A title will preferably be short.
BaseSchemaIt can be used to decorate a user interface with information about the data produced by this user interface. A description provides explanation about the purpose of the instance described by the schema.
BaseSchemaThe value of this keyword MUST be an array. There are no restrictions placed on the values within the array.
BaseSchemaThe value must be a valid id e.g. #properties/foo
BaseSchemaThe value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique.
BaseSchemaThe value of this keyword MAY be of any type, including null.
BaseSchemaThere are no restrictions placed on the value of this keyword.
BaseSchemaThe value of readOnly can be left empty to indicate the property is readOnly. It takes an optional boolean which can be used to explicitly set readOnly true/false.
BaseSchemaThe value of writeOnly can be left empty to indicate the property is writeOnly. It takes an optional boolean which can be used to explicitly set writeOnly true/false.
BaseSchemaThe value of deprecated can be left empty to indicate the property is deprecated. It takes an optional boolean which can be used to explicitly set deprecated true/false.
FluentSchemaRequired has to be chained to a property: Examples:
BaseSchemaThis keyword's value MUST be a valid JSON Schema. An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword.
BaseSchemaIt MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
BaseSchemaIt MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
BaseSchemaIt MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
BaseSchemaThis validation outcome of this keyword's subschema has no direct effect on the overall validation result. Rather, it controls which of the "then" or "else" keywords are evaluated. When "if" is present, and the instance successfully validates against its subschema, then validation succeeds against this keyword if the instance also successfully validates against this keyword's subschema.
BaseSchemaWhen "if" is present, and the instance fails to validate against its subschema, then validation succeeds against this keyword if the instance successfully validates against this keyword's subschema.
BaseSchemaBecause the differences between JSON Schemas and Open API (Swagger) it can be handy to arbitrary modify the schema injecting a fragment
objectIt returns all the schema values
StringSchemaRepresents a BooleanSchema.
SRepresents a S.
StringSchemaSet a property to type string
NumberSchemaSet a property to type number
IntegerSchemaSet a property to type integer
BooleanSchemaSet a property to type boolean
ArraySchemaSet a property to type array
ObjectSchemaSet a property to type object
NullSchemaSet a property to type null
MixedSchemaA mixed schema is the union of multiple types (e.g. ['string', 'integer']
BaseSchemaBecause the differences between JSON Schemas and Open API (Swagger) it can be handy to arbitrary modify the schema injecting a fragment
NumberSchemaRepresents a NumberSchema.
StringSchemaRepresents a MixedSchema.
StringSchemaRepresents a NullSchema.
FluentSchemaSet a property to type null
NumberSchemaRepresents a NumberSchema.
FluentSchemaIt represents an inclusive lower limit for a numeric instance.
FluentSchemaIt represents an exclusive lower limit for a numeric instance.
FluentSchemaIt represents an inclusive upper limit for a numeric instance.
FluentSchemaIt represents an exclusive upper limit for a numeric instance.
FluentSchemaIt's strictly greater than 0.
StringSchemaRepresents a ObjectSchema.
It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.
Calling id on an ObjectSchema will alway set the id on the root of the object rather than in its "properties", which
differs from other schema types.
FluentSchemaThis keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. Validation with "additionalProperties" applies only to the child values of instance names that do not match any names in "properties", and do not match any regular expression in "patternProperties". For all such properties, validation succeeds if the child instance validates against the "additionalProperties" schema. Omitting this keyword has the same behavior as an empty schema.
FluentSchemaAn object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
FluentSchemaAn object instance is valid against "minProperties" if its number of properties is greater than, or equal to, the value of this keyword.
FluentSchemaEach property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. Each property value of this object MUST be a valid JSON Schema. This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. Validation of the primitive instance type against this keyword always succeeds. Validation succeeds if, for each instance name that matches any regular expressions that appear as a property name in this keyword's value, the child instance for that name successfully validates against each schema that corresponds to a matching regular expression.
FluentSchemaThis keyword specifies rules that are evaluated if the instance is an object and contains a certain property. This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST be an array or a valid JSON Schema. If the dependency value is a subschema, and the dependency key is a property in the instance, the entire instance must validate against the dependency value. If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST be unique. If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance.
FluentSchemaThe value of "properties" MUST be an object. Each dependency value MUST be an array. Each element in the array MUST be a string and MUST be unique. If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance.
FluentSchemaThe value of "properties" MUST be an object. The dependency value MUST be a valid JSON Schema. Each dependency key is a property in the instance and the entire instance must validate against the dependency value.
FluentSchemaIf the instance is an object, this keyword validates if every property name in the instance validates against the provided schema. Note the property name that the schema is testing will always be a string.
FluentSchemaThe value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema.
ObjectSchemaReturns an object schema with only a subset of keys provided. If called on an ObjectSchema with an
$id, it will be removed and the return value will be considered a new schema.
ObjectSchemaReturns an object schema without a subset of keys provided. If called on an ObjectSchema with an
$id, it will be removed and the return value will be considered a new schema.
FluentSchemaThe "definitions" keywords provides a standardized location for schema authors to inline re-usable JSON Schemas into a more general schema. There are no restrictions placed on the values within the array.
FluentSchemaRepresents a raw JSON Schema that will be parsed
StringSchemaRepresents a StringSchema.
StringSchemaA string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].
StringSchemaA string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].
StringSchemaA string value can be RELATIVE_JSON_POINTER, JSON_POINTER, UUID, REGEX, IPV6, IPV4, HOSTNAME, EMAIL, URL, URI_TEMPLATE, URI_REFERENCE, URI, TIME, DATE, DATE_TIME, ISO_TIME, ISO_DATE_TIME.
StringSchemaThis string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. A string instance is considered valid if the regular expression matches the instance successfully.
StringSchemaIf the instance value is a string, this property defines that the string SHOULD be interpreted as binary data and decoded using the encoding named by this property. RFC 2045, Sec 6.1 [RFC2045] lists the possible values for this property.
StringSchemaThe value of this property must be a media type, as defined by RFC 2046 [RFC2046]. This property defines the media type of instances which this schema defines.
ArraySchema](#ArraySchema)
Represents a ArraySchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [StringSchema](#StringSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## items(items) ⇒ FluentSchema
This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
If "items" is a schema, validation succeeds if all elements in the array successfully validate against that schema.
If "items" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same position, if any.
Omitting this keyword has the same behavior as an empty schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.1)
**Kind**: global function
| Param | Type |
| --- | --- |
| items | FluentSchema \| Array.<FluentSchema> |
## additionalItems(items) ⇒ FluentSchema
This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.2)
**Kind**: global function
| Param | Type |
| --- | --- |
| items | FluentSchema \| [boolean](#boolean) |
## contains(value) ⇒ FluentSchema
An array instance is valid against "contains" if at least one of its elements is valid against the given schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.6)
**Kind**: global function
| Param | Type |
| --- | --- |
| value | FluentSchema |
## uniqueItems(boolean) ⇒ FluentSchema
If this keyword has boolean value false, the instance validates successfully.
If it has boolean value true, the instance validates successfully if all of its elements are unique.
Omitting this keyword has the same behavior as a value of false.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.5)
**Kind**: global function
| Param | Type |
| --- | --- |
| boolean | [boolean](#boolean) |
## minItems(min) ⇒ FluentSchema
An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.
Omitting this keyword has the same behavior as a value of 0.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| min | [number](#number) |
## maxItems(max) ⇒ FluentSchema
An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.
Omitting this keyword has the same behavior as a value of 0.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| max | [number](#number) |
## BaseSchema([options]) ⇒ [BaseSchema](#BaseSchema)
Represents a BaseSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [BaseSchema](#BaseSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## id(id) ⇒ [BaseSchema](#BaseSchema)
It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.
[reference](https://tools.ietf.org/html/draft-handrews-json-schema-01#section-8.2)
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| id | [string](#string) | an #id |
## title(title) ⇒ [BaseSchema](#BaseSchema)
It can be used to decorate a user interface with information about the data produced by this user interface. A title will preferably be short.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1)
**Kind**: global function
| Param | Type |
| --- | --- |
| title | [string](#string) |
## description(description) ⇒ [BaseSchema](#BaseSchema)
It can be used to decorate a user interface with information about the data
produced by this user interface. A description provides explanation about
the purpose of the instance described by the schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1)
**Kind**: global function
| Param | Type |
| --- | --- |
| description | [string](#string) |
## examples(examples) ⇒ [BaseSchema](#BaseSchema)
The value of this keyword MUST be an array.
There are no restrictions placed on the values within the array.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| examples | [string](#string) |
## ref(ref) ⇒ [BaseSchema](#BaseSchema)
The value must be a valid id e.g. #properties/foo
**Kind**: global function
| Param | Type |
| --- | --- |
| ref | [string](#string) |
## enum(values) ⇒ [BaseSchema](#BaseSchema)
The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.2)
**Kind**: global function
| Param | Type |
| --- | --- |
| values | [array](#array) |
## const(value) ⇒ [BaseSchema](#BaseSchema)
The value of this keyword MAY be of any type, including null.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.3)
**Kind**: global function
| Param |
| --- |
| value |
## default(defaults) ⇒ [BaseSchema](#BaseSchema)
There are no restrictions placed on the value of this keyword.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.2)
**Kind**: global function
| Param |
| --- |
| defaults |
## readOnly(isReadOnly) ⇒ [BaseSchema](#BaseSchema)
The value of readOnly can be left empty to indicate the property is readOnly.
It takes an optional boolean which can be used to explicitly set readOnly true/false.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| isReadOnly | [boolean](#boolean) \| undefined |
## writeOnly(isWriteOnly) ⇒ [BaseSchema](#BaseSchema)
The value of writeOnly can be left empty to indicate the property is writeOnly.
It takes an optional boolean which can be used to explicitly set writeOnly true/false.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| isWriteOnly | [boolean](#boolean) \| undefined |
## deprecated(isDeprecated) ⇒ [BaseSchema](#BaseSchema)
The value of deprecated can be left empty to indicate the property is deprecated.
It takes an optional boolean which can be used to explicitly set deprecated true/false.
[reference](https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| isDeprecated | Boolean |
## required() ⇒ FluentSchema
Required has to be chained to a property:
Examples:
- S.prop('prop').required()
- S.prop('prop', S.number()).required()
- S.required(['foo', 'bar'])
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.3)
**Kind**: global function
## not(not) ⇒ [BaseSchema](#BaseSchema)
This keyword's value MUST be a valid JSON Schema.
An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| not | FluentSchema |
## anyOf(schemas) ⇒ [BaseSchema](#BaseSchema)
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.2)
**Kind**: global function
| Param | Type |
| --- | --- |
| schemas | [array](#array) |
## allOf(schemas) ⇒ [BaseSchema](#BaseSchema)
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.1)
**Kind**: global function
| Param | Type |
| --- | --- |
| schemas | [array](#array) |
## oneOf(schemas) ⇒ [BaseSchema](#BaseSchema)
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| schemas | [array](#array) |
## ifThen(ifClause, thenClause) ⇒ [BaseSchema](#BaseSchema)
This validation outcome of this keyword's subschema has no direct effect on the overall validation result.
Rather, it controls which of the "then" or "else" keywords are evaluated.
When "if" is present, and the instance successfully validates against its subschema, then
validation succeeds against this keyword if the instance also successfully validates against this keyword's subschema.
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| ifClause | [BaseSchema](#BaseSchema) | [reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.1) |
| thenClause | [BaseSchema](#BaseSchema) | [reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.2) |
## ifThenElse(ifClause, thenClause, elseClause) ⇒ [BaseSchema](#BaseSchema)
When "if" is present, and the instance fails to validate against its subschema,
then validation succeeds against this keyword if the instance successfully validates against this keyword's subschema.
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| ifClause | [BaseSchema](#BaseSchema) | [reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.1) |
| thenClause | [BaseSchema](#BaseSchema) | [reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.2) |
| elseClause | [BaseSchema](#BaseSchema) | [reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.3) |
## raw(fragment) ⇒ [BaseSchema](#BaseSchema)
Because the differences between JSON Schemas and Open API (Swagger)
it can be handy to arbitrary modify the schema injecting a fragment
* Examples:
- S.number().raw({ nullable:true })
- S.string().format('date').raw({ formatMaximum: '2020-01-01' })
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| fragment | [string](#string) | an arbitrary JSON Schema to inject [reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.3) |
## valueOf([options]) ⇒ [object](#object)
It returns all the schema values
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.isRoot] | [boolean](#boolean) | true | Is a root level schema |
## BooleanSchema([options]) ⇒ [StringSchema](#StringSchema)
Represents a BooleanSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [StringSchema](#StringSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## S([options]) ⇒ [S](#S)
Represents a S.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [S](#S) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## string() ⇒ [StringSchema](#StringSchema)
Set a property to type string
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3)
**Kind**: global function
## number() ⇒ [NumberSchema](#NumberSchema)
Set a property to type number
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric)
**Kind**: global function
## integer() ⇒ [IntegerSchema](#IntegerSchema)
Set a property to type integer
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric)
**Kind**: global function
## boolean() ⇒ [BooleanSchema](#BooleanSchema)
Set a property to type boolean
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7)
**Kind**: global function
## array() ⇒ [ArraySchema](#ArraySchema)
Set a property to type array
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4)
**Kind**: global function
## object() ⇒ [ObjectSchema](#ObjectSchema)
Set a property to type object
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5)
**Kind**: global function
## null() ⇒ [NullSchema](#NullSchema)
Set a property to type null
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#general)
**Kind**: global function
## mixed(types) ⇒ [MixedSchema](#MixedSchema)
A mixed schema is the union of multiple types (e.g. ['string', 'integer']
**Kind**: global function
| Param | Type |
| --- | --- |
| types | [Array.<string>](#string) |
## raw(fragment) ⇒ [BaseSchema](#BaseSchema)
Because the differences between JSON Schemas and Open API (Swagger)
it can be handy to arbitrary modify the schema injecting a fragment
* Examples:
- S.raw({ nullable:true, format: 'date', formatMaximum: '2020-01-01' })
- S.string().format('date').raw({ formatMaximum: '2020-01-01' })
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| fragment | [string](#string) | an arbitrary JSON Schema to inject |
## IntegerSchema([options]) ⇒ [NumberSchema](#NumberSchema)
Represents a NumberSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [NumberSchema](#NumberSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## MixedSchema([options]) ⇒ [StringSchema](#StringSchema)
Represents a MixedSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [MixedSchema](#MixedSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## NullSchema([options]) ⇒ [StringSchema](#StringSchema)
Represents a NullSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [StringSchema](#StringSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## null() ⇒ FluentSchema
Set a property to type null
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.1)
**Kind**: global function
## NumberSchema([options]) ⇒ [NumberSchema](#NumberSchema)
Represents a NumberSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [NumberSchema](#NumberSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## minimum(min) ⇒ FluentSchema
It represents an inclusive lower limit for a numeric instance.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| min | [number](#number) |
## exclusiveMinimum(min) ⇒ FluentSchema
It represents an exclusive lower limit for a numeric instance.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.5)
**Kind**: global function
| Param | Type |
| --- | --- |
| min | [number](#number) |
## maximum(max) ⇒ FluentSchema
It represents an inclusive upper limit for a numeric instance.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.2)
**Kind**: global function
| Param | Type |
| --- | --- |
| max | [number](#number) |
## exclusiveMaximum(max) ⇒ FluentSchema
It represents an exclusive upper limit for a numeric instance.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| max | [number](#number) |
## multipleOf(multiple) ⇒ FluentSchema
It's strictly greater than 0.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.1)
**Kind**: global function
| Param | Type |
| --- | --- |
| multiple | [number](#number) |
## ObjectSchema([options]) ⇒ [StringSchema](#StringSchema)
Represents a ObjectSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [StringSchema](#StringSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## id(id)
It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.
Calling `id` on an ObjectSchema will alway set the id on the root of the object rather than in its "properties", which
differs from other schema types.
[reference](https://tools.ietf.org/html/draft-handrews-json-schema-01#section-8.2)
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| id | [string](#string) | an #id |
## additionalProperties(value) ⇒ FluentSchema
This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.
Validation with "additionalProperties" applies only to the child values of instance names that do not match any names in "properties",
and do not match any regular expression in "patternProperties".
For all such properties, validation succeeds if the child instance validates against the "additionalProperties" schema.
Omitting this keyword has the same behavior as an empty schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.6)
**Kind**: global function
| Param | Type |
| --- | --- |
| value | FluentSchema \| [boolean](#boolean) |
## maxProperties(max) ⇒ FluentSchema
An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.1)
**Kind**: global function
| Param | Type |
| --- | --- |
| max | [number](#number) |
## minProperties(min) ⇒ FluentSchema
An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, the value of this keyword.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.2)
**Kind**: global function
| Param | Type |
| --- | --- |
| min | [number](#number) |
## patternProperties(opts) ⇒ FluentSchema
Each property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect.
Each property value of this object MUST be a valid JSON Schema.
This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.
Validation of the primitive instance type against this keyword always succeeds.
Validation succeeds if, for each instance name that matches any regular expressions that appear as a property name in this keyword's value, the child instance for that name successfully validates against each schema that corresponds to a matching regular expression.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.5)
**Kind**: global function
| Param | Type |
| --- | --- |
| opts | [object](#object) |
## dependencies(opts) ⇒ FluentSchema
This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.
This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST be an array or a valid JSON Schema.
If the dependency value is a subschema, and the dependency key is a property in the instance, the entire instance must validate against the dependency value.
If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST be unique. If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.7)
**Kind**: global function
| Param | Type |
| --- | --- |
| opts | [object](#object) |
## dependentRequired(opts) ⇒ FluentSchema
The value of "properties" MUST be an object. Each dependency value MUST be an array.
Each element in the array MUST be a string and MUST be unique. If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance.
[reference](https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.5.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| opts | [object](#object) |
## dependentSchemas(opts) ⇒ FluentSchema
The value of "properties" MUST be an object. The dependency value MUST be a valid JSON Schema.
Each dependency key is a property in the instance and the entire instance must validate against the dependency value.
[reference](https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.2.2.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| opts | [object](#object) |
## propertyNames(value) ⇒ FluentSchema
If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema.
Note the property name that the schema is testing will always be a string.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.8)
**Kind**: global function
| Param | Type |
| --- | --- |
| value | FluentSchema |
## prop(name, props) ⇒ FluentSchema
The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| name | [string](#string) |
| props | FluentSchema |
## only(properties) ⇒ [ObjectSchema](#ObjectSchema)
Returns an object schema with only a subset of keys provided. If called on an ObjectSchema with an
`$id`, it will be removed and the return value will be considered a new schema.
**Kind**: global function
| Param | Description |
| --- | --- |
| properties | a list of properties you want to keep |
## without(properties) ⇒ [ObjectSchema](#ObjectSchema)
Returns an object schema without a subset of keys provided. If called on an ObjectSchema with an
`$id`, it will be removed and the return value will be considered a new schema.
**Kind**: global function
| Param | Description |
| --- | --- |
| properties | a list of properties you dont want to keep |
## definition(name, props) ⇒ FluentSchema
The "definitions" keywords provides a standardized location for schema authors to inline re-usable JSON Schemas into a more general schema.
There are no restrictions placed on the values within the array.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.9)
**Kind**: global function
| Param | Type |
| --- | --- |
| name | [string](#string) |
| props | FluentSchema |
## RawSchema(schema) ⇒ FluentSchema
Represents a raw JSON Schema that will be parsed
**Kind**: global function
| Param | Type |
| --- | --- |
| schema | Object |
## StringSchema([options]) ⇒ [StringSchema](#StringSchema)
Represents a StringSchema.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | Object | | Options |
| [options.schema] | [StringSchema](#StringSchema) | | Default schema |
| [options.generateIds] | [boolean](#boolean) | false | generate the id automatically e.g. #properties.foo |
## minLength(min) ⇒ [StringSchema](#StringSchema)
A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.2)
**Kind**: global function
| Param | Type |
| --- | --- |
| min | [number](#number) |
## maxLength(max) ⇒ [StringSchema](#StringSchema)
A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.1)
**Kind**: global function
| Param | Type |
| --- | --- |
| max | [number](#number) |
## format(format) ⇒ [StringSchema](#StringSchema)
A string value can be RELATIVE_JSON_POINTER, JSON_POINTER, UUID, REGEX, IPV6, IPV4, HOSTNAME, EMAIL, URL, URI_TEMPLATE, URI_REFERENCE, URI, TIME, DATE, DATE_TIME, ISO_TIME, ISO_DATE_TIME.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.7.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| format | [string](#string) |
## pattern(pattern) ⇒ [StringSchema](#StringSchema)
This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect.
A string instance is considered valid if the regular expression matches the instance successfully.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| pattern | [string](#string) |
## contentEncoding(encoding) ⇒ [StringSchema](#StringSchema)
If the instance value is a string, this property defines that the string SHOULD
be interpreted as binary data and decoded using the encoding named by this property.
RFC 2045, Sec 6.1 [RFC2045] lists the possible values for this property.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.8.3)
**Kind**: global function
| Param | Type |
| --- | --- |
| encoding | [string](#string) |
## contentMediaType(mediaType) ⇒ [StringSchema](#StringSchema)
The value of this property must be a media type, as defined by RFC 2046 [RFC2046].
This property defines the media type of instances which this schema defines.
[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.8.4)
**Kind**: global function
| Param | Type |
| --- | --- |
| mediaType | [string](#string) |