- 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.
- const(value) ⇒
BaseSchema
The value of this keyword MAY be of any type, including null.
- default(defaults) ⇒
BaseSchema
There are no restrictions placed on the value of this keyword.
- 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.
- 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.
- deprecated(isDeprecated) ⇒
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.
- 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'])
- not(not) ⇒
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.
- anyOf(schemas) ⇒
BaseSchema
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
- allOf(schemas) ⇒
BaseSchema
It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.
- 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([options]) ⇒
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
- number() ⇒
NumberSchema
Set a property to type number
- integer() ⇒
IntegerSchema
Set a property to type integer
- boolean() ⇒
BooleanSchema
Set a property to type boolean
- array() ⇒
ArraySchema
Set a property to type array
- object() ⇒
ObjectSchema
Set a property to type object
- null() ⇒
NullSchema
Set a property to type null
- 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
- NumberSchema([options]) ⇒
NumberSchema
Represents a NumberSchema.
- minimum(min) ⇒
FluentSchema
It represents an inclusive lower limit for a numeric instance.
- exclusiveMinimum(min) ⇒
FluentSchema
It represents an exclusive lower limit for a numeric instance.
- maximum(max) ⇒
FluentSchema
It represents an inclusive upper limit for a numeric instance.
- 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.
- 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.- 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.
- 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.
- 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.
- 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.
- only(properties) ⇒
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.- without(properties) ⇒
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.- 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.
- 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 |
---|---|
items | FluentSchema | Array.<FluentSchema> |
This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
Kind: global function
Param | Type |
---|---|
items | FluentSchema | boolean |
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 |
---|---|
value | 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.
Kind: global function
Param | Type |
---|---|
boolean | boolean |
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 |
---|---|
min | number |
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 |
---|---|
max | number |
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.
Kind: global function
Param | Type |
---|---|
values | array |
const(value) ⇒ BaseSchema
The value of this keyword MAY be of any type, including null.
Kind: global function
Param |
---|
value |
default(defaults) ⇒ BaseSchema
There are no restrictions placed on the value of this keyword.
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.
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.
Kind: global function
Param | Type |
---|---|
isWriteOnly | boolean | undefined |
deprecated(isDeprecated) ⇒ 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.
Kind: global function
Param | Type |
---|---|
isDeprecated | Boolean |
Required has to be chained to a property: Examples:
- S.prop('prop').required()
- S.prop('prop', S.number()).required()
- S.required(['foo', 'bar'])
not(not) ⇒ 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.
Kind: global function
Param | Type |
---|---|
not | FluentSchema |
anyOf(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 |
---|---|
schemas | array |
allOf(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 |
---|---|
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 |
---|---|
schemas | array |
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 |
reference |
thenClause | BaseSchema |
reference |
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 |
reference |
thenClause | BaseSchema |
reference |
elseClause | BaseSchema |
reference |
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 reference |
valueOf([options]) ⇒ object
It returns all the schema values
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
Options | |
[options.isRoot] | boolean |
true |
Is a root level schema |
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
number() ⇒ NumberSchema
Set a property to type number
integer() ⇒ IntegerSchema
Set a property to type integer
boolean() ⇒ BooleanSchema
Set a property to type boolean
array() ⇒ ArraySchema
Set a property to type array
object() ⇒ ObjectSchema
Set a property to type object
null() ⇒ NullSchema
Set a property to type null
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 |
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
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 |
---|---|
min | number |
It represents an exclusive lower limit for a numeric instance.
Kind: global function
Param | Type |
---|---|
min | number |
It represents an inclusive upper limit for a numeric instance.
Kind: global function
Param | Type |
---|---|
max | number |
It represents an exclusive upper limit for a numeric instance.
Kind: global function
Param | Type |
---|---|
max | number |
It's strictly greater than 0.
Kind: global function
Param | Type |
---|---|
multiple | number |
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 |
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.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
an #id |
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 |
---|---|
value | FluentSchema | boolean |
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 |
---|---|
max | number |
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 |
---|---|
min | number |
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 |
---|---|
opts | object |
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 |
---|---|
opts | object |
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.
Kind: global function
Param | Type |
---|---|
opts | object |
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.
Kind: global function
Param | Type |
---|---|
opts | object |
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 |
---|---|
value | FluentSchema |
The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema.
Kind: global function
Param | Type |
---|---|
name | string |
props | FluentSchema |
only(properties) ⇒ 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
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 |
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.
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 |
---|---|
min | number |
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 |
---|---|
max | number |
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 |
---|---|
format | string |
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 |
---|---|
pattern | string |
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 |
---|---|
encoding | string |
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 |
---|---|
mediaType | string |