- ArraySchema([options]) ⇒
ArraySchema Represents a ArraySchema.
- 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.
- additionalItems(items) ⇒
FluentSchema This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
- contains(value) ⇒
FluentSchema An array instance is valid against "contains" if at least one of its elements is valid against the given schema.
- 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.
- 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.
- 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.
- BaseSchema([options]) ⇒
BaseSchema Represents a BaseSchema.
- id(id) ⇒
BaseSchema It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.
- title(title) ⇒
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.
- description(description) ⇒
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.
- examples(examples) ⇒
BaseSchema The value of this keyword MUST be an array. There are no restrictions placed on the values within the array.
- ref(ref) ⇒
BaseSchema The value must be a valid id e.g. #properties/foo
- enum(values) ⇒
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.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2
- const(value) ⇒
BaseSchema The value of this keyword MAY be of any type, including null.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.3
- default(defaults) ⇒
BaseSchema There are no restrictions placed on the value of this keyword.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.2
- readOnly(isReadOnly) ⇒
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
https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3
- writeOnly(isWriteOnly) ⇒
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
https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3
- 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'])
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3
- anyOf(schemas) ⇒
BaseSchema It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3
- allOf(schemas) ⇒
BaseSchema It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.1
- oneOf(schemas) ⇒
BaseSchema It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
- ifThen(ifClause, thenClause) ⇒
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.
- ifThenElse(ifClause, thenClause, elseClause) ⇒
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.
- raw(fragment) ⇒
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' })
- valueOf() ⇒
object It returns all the schema values
- BooleanSchema([options]) ⇒
StringSchema Represents a BooleanSchema.
- S([options]) ⇒
S Represents a S.
- string() ⇒
StringSchema Set a property to type string
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
- number() ⇒
NumberSchema Set a property to type number
https://json-schema.org/latest/json-schema-validation.html#numeric
- integer() ⇒
IntegerSchema Set a property to type integer
https://json-schema.org/latest/json-schema-validation.html#numeric
- boolean() ⇒
BooleanSchema Set a property to type boolean
https://json-schema.org/latest/json-schema-validation.html#general
- array() ⇒
ArraySchema Set a property to type array
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4
- object() ⇒
ObjectSchema Set a property to type object
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5
- null() ⇒
NullSchema Set a property to type null
https://json-schema.org/latest/json-schema-validation.html#general
- mixed(types) ⇒
MixedSchema A mixed schema is the union of multiple types (e.g. ['string', 'integer']
- raw(fragment) ⇒
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' })
- IntegerSchema([options]) ⇒
NumberSchema Represents a NumberSchema.
- MixedSchema([options]) ⇒
StringSchema Represents a MixedSchema.
- NullSchema([options]) ⇒
StringSchema Represents a NullSchema.
- null() ⇒
FluentSchema Set a property to type null
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
- NumberSchema([options]) ⇒
NumberSchema Represents a NumberSchema.
- minimum(min) ⇒
FluentSchema It represents an inclusive lower limit for a numeric instance.
- exclusiveMinimum() ⇒
FluentSchema It represents an exclusive lower limit for a numeric instance.
- @param {number} min https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.5
- maximum() ⇒
FluentSchema It represents an inclusive upper limit for a numeric instance. https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2
- exclusiveMaximum(max) ⇒
FluentSchema It represents an exclusive upper limit for a numeric instance.
- multipleOf(multiple) ⇒
FluentSchema It's strictly greater than 0.
- ObjectSchema([options]) ⇒
StringSchema Represents a ObjectSchema.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- prop(name, props) ⇒
FluentSchema The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4
- 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.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.9
- RawSchema(schema) ⇒
FluentSchema Represents a raw JSON Schema that will be parsed
- StringSchema([options]) ⇒
StringSchema Represents a StringSchema.
- minLength(min) ⇒
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].
- maxLength(max) ⇒
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].
- format(format) ⇒
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,
- pattern(pattern) ⇒
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.
- contentEncoding(encoding) ⇒
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.
- contentMediaType(mediaType) ⇒
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.
ArraySchema([options]) ⇒ ArraySchema
Represents a ArraySchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | StringSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| items | FluentSchema | Array.<FluentSchema> |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.1 |
This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
Kind: global function
| Param | Type | Description |
|---|---|---|
| items | FluentSchema | boolean |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.2 |
An array instance is valid against "contains" if at least one of its elements is valid against the given schema.
Kind: global function
| Param | Type | Description |
|---|---|---|
| value | FluentSchema |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.2 |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| boolean | boolean |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.5 |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| min | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.4 |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| max | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.3 |
BaseSchema([options]) ⇒ BaseSchema
Represents a BaseSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | BaseSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
id(id) ⇒ BaseSchema
It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.
Kind: global function
| Param | Type | Description |
|---|---|---|
| id | string |
an #id |
title(title) ⇒ 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.
Kind: global function
| Param | Type |
|---|---|
| title | string |
description(description) ⇒ 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.
Kind: global function
| Param | Type |
|---|---|
| description | string |
examples(examples) ⇒ BaseSchema
The value of this keyword MUST be an array. There are no restrictions placed on the values within the array.
Kind: global function
| Param | Type |
|---|---|
| examples | string |
ref(ref) ⇒ BaseSchema
The value must be a valid id e.g. #properties/foo
Kind: global function
| Param | Type |
|---|---|
| ref | string |
enum(values) ⇒ 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.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2
Kind: global function
| Param | Type |
|---|---|
| values | array |
const(value) ⇒ BaseSchema
The value of this keyword MAY be of any type, including null.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.3
Kind: global function
| Param |
|---|
| value |
default(defaults) ⇒ BaseSchema
There are no restrictions placed on the value of this keyword.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.2
Kind: global function
| Param |
|---|
| defaults |
readOnly(isReadOnly) ⇒ 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
https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3
Kind: global function
| Param | Type |
|---|---|
| isReadOnly | boolean | undefined |
writeOnly(isWriteOnly) ⇒ 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
https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3
Kind: global function
| Param | Type |
|---|---|
| isWriteOnly | boolean | undefined |
Required has to be chained to a property: Examples:
- S.prop('prop').required()
- S.prop('prop', S.number()).required()
- S.required(['foo', 'bar'])
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3
anyOf(schemas) ⇒ BaseSchema
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3
Kind: global function
| Param | Type |
|---|---|
| schemas | array |
allOf(schemas) ⇒ BaseSchema
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.1
Kind: global function
| Param | Type |
|---|---|
| schemas | array |
oneOf(schemas) ⇒ BaseSchema
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
Kind: global function
| Param | Type | Description |
|---|---|---|
| schemas | array |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.2 |
ifThen(ifClause, thenClause) ⇒ 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 |
|
| thenClause | BaseSchema |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.6.1 |
ifThenElse(ifClause, thenClause, elseClause) ⇒ 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 |
|
| thenClause | BaseSchema |
|
| elseClause | BaseSchema |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.6.1 |
raw(fragment) ⇒ 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 |
an arbitrary JSON Schema to inject https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3 |
valueOf() ⇒ object
It returns all the schema values
BooleanSchema([options]) ⇒ StringSchema
Represents a BooleanSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | StringSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
S([options]) ⇒ S
Represents a S.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | S |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
string() ⇒ StringSchema
Set a property to type string
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
number() ⇒ NumberSchema
Set a property to type number
https://json-schema.org/latest/json-schema-validation.html#numeric
integer() ⇒ IntegerSchema
Set a property to type integer
https://json-schema.org/latest/json-schema-validation.html#numeric
boolean() ⇒ BooleanSchema
Set a property to type boolean
https://json-schema.org/latest/json-schema-validation.html#general
array() ⇒ ArraySchema
Set a property to type array
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4
object() ⇒ ObjectSchema
Set a property to type object
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5
null() ⇒ NullSchema
Set a property to type null
https://json-schema.org/latest/json-schema-validation.html#general
mixed(types) ⇒ MixedSchema
A mixed schema is the union of multiple types (e.g. ['string', 'integer']
Kind: global function
| Param | Type |
|---|---|
| types | [ 'Array' ].<string> |
raw(fragment) ⇒ 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 |
an arbitrary JSON Schema to inject https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3 |
IntegerSchema([options]) ⇒ NumberSchema
Represents a NumberSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | NumberSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
MixedSchema([options]) ⇒ StringSchema
Represents a MixedSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | MixedSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
NullSchema([options]) ⇒ StringSchema
Represents a NullSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | StringSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
Set a property to type null
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
NumberSchema([options]) ⇒ NumberSchema
Represents a NumberSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | NumberSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
It represents an inclusive lower limit for a numeric instance.
Kind: global function
| Param | Type | Description |
|---|---|---|
| min | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4 |
It represents an exclusive lower limit for a numeric instance.
- @param {number} min https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.5
It represents an inclusive upper limit for a numeric instance. https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2
It represents an exclusive upper limit for a numeric instance.
Kind: global function
| Param | Type | Description |
|---|---|---|
| max | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.3 |
It's strictly greater than 0.
Kind: global function
| Param | Type | Description |
|---|---|---|
| multiple | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.1 |
ObjectSchema([options]) ⇒ StringSchema
Represents a ObjectSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | StringSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| value | FluentSchema | boolean |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.6 |
An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
Kind: global function
| Param | Type | Description |
|---|---|---|
| max | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.1 |
An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, the value of this keyword.
Kind: global function
| Param | Type | Description |
|---|---|---|
| min | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.2 |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| opts | object |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.5 |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| opts | object |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7 |
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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| value | FluentSchema |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7 |
The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4
Kind: global function
| Param | Type |
|---|---|
| name | string |
| 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.
https://json-schema.org/latest/json-schema-validation.html#rfc.section.9
Kind: global function
| Param | Type |
|---|---|
| name | string |
| props | FluentSchema |
Represents a raw JSON Schema that will be parsed
Kind: global function
| Param | Type |
|---|---|
| schema | Object |
StringSchema([options]) ⇒ StringSchema
Represents a StringSchema.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | Object |
Options | |
| [options.schema] | StringSchema |
Default schema | |
| [options.generateIds] | boolean |
false |
generate the id automatically e.g. #properties.foo |
minLength(min) ⇒ 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].
Kind: global function
| Param | Type | Description |
|---|---|---|
| min | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.2 |
maxLength(max) ⇒ 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].
Kind: global function
| Param | Type | Description |
|---|---|---|
| max | number |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.2 |
format(format) ⇒ 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,
Kind: global function
| Param | Type | Description |
|---|---|---|
| format | string |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3 |
pattern(pattern) ⇒ 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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| pattern | string |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3 |
contentEncoding(encoding) ⇒ 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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| encoding | string |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3 |
contentMediaType(mediaType) ⇒ 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.
Kind: global function
| Param | Type | Description |
|---|---|---|
| mediaType | string |
https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3 |