diff --git a/docs/API.md b/docs/API.md index 17cc746..2eece3f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -9,72 +9,78 @@ 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

additionalItems(items)FluentSchema

This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.

+

reference

contains(value)FluentSchema

An array instance is valid against "contains" if at least one of its elements is valid against the given schema.

+

reference

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

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

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

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.

-

reference

+

reference

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.

-

reference

+

reference

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.

-

reference

+

reference

examples(examples)BaseSchema

The value of this keyword MUST be an array. There are no restrictions placed on the values within the array.

-

reference

+

reference

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

+

reference

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

+

reference

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

+

reference

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

+It takes an optional boolean which can be used to explicitly set readOnly true/false.

+

reference

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

+It takes an optional boolean which can be used to explicitly set writeOnly true/false.

+

reference

required()FluentSchema

Required has to be chained to a property: @@ -84,18 +90,24 @@ Examples:

  • S.prop('prop', S.number()).required()
  • S.required(['foo', 'bar'])
  • -

    https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3

    +

    reference

    +
    +
    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.

    +

    reference

    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

    +

    It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.

    +

    reference

    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

    +

    reference

    oneOf(schemas)BaseSchema

    It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.

    +

    reference

    ifThen(ifClause, thenClause)BaseSchema

    This validation outcome of this keyword's subschema has no direct effect on the overall validation result. @@ -127,31 +139,31 @@ it can be handy to arbitrary modify the schema injecting a fragment

    string()StringSchema

    Set a property to type string

    -

    https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1

    +

    reference

    number()NumberSchema

    Set a property to type number

    -

    https://json-schema.org/latest/json-schema-validation.html#numeric

    +

    reference

    integer()IntegerSchema

    Set a property to type integer

    -

    https://json-schema.org/latest/json-schema-validation.html#numeric

    +

    reference

    boolean()BooleanSchema

    Set a property to type boolean

    -

    https://json-schema.org/latest/json-schema-validation.html#general

    +

    reference

    array()ArraySchema

    Set a property to type array

    -

    https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4

    +

    reference

    object()ObjectSchema

    Set a property to type object

    -

    https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5

    +

    reference

    null()NullSchema

    Set a property to type null

    -

    https://json-schema.org/latest/json-schema-validation.html#general

    +

    reference

    mixed(types)MixedSchema

    A mixed schema is the union of multiple types (e.g. ['string', 'integer']

    @@ -176,30 +188,30 @@ it can be handy to arbitrary modify the schema injecting a fragment

    null()FluentSchema

    Set a property to type null

    -

    https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1

    +

    reference

    NumberSchema([options])NumberSchema

    Represents a NumberSchema.

    minimum(min)FluentSchema

    It represents an inclusive lower limit for a numeric instance.

    +

    reference

    -
    exclusiveMinimum()FluentSchema
    +
    exclusiveMinimum(min)FluentSchema

    It represents an exclusive lower limit for a numeric instance.

    - +

    reference

    -
    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

    +
    maximum(max)FluentSchema
    +

    It represents an inclusive upper limit for a numeric instance.

    +

    reference

    exclusiveMaximum(max)FluentSchema

    It represents an exclusive upper limit for a numeric instance.

    +

    reference

    multipleOf(multiple)FluentSchema

    It's strictly greater than 0.

    +

    reference

    ObjectSchema([options])StringSchema

    Represents a ObjectSchema.

    @@ -210,12 +222,15 @@ Validation with "additionalProperties" applies only to the child value 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

    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

    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

    patternProperties(opts)FluentSchema

    Each property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. @@ -223,25 +238,28 @@ 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

    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

    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

    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

    +

    The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema.

    +

    reference

    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

    +

    reference

    RawSchema(schema)FluentSchema

    Represents a raw JSON Schema that will be parsed

    @@ -252,26 +270,32 @@ There are no restrictions placed on the values within the array.

    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].

    +

    reference

    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].

    +

    reference

    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,

    +

    reference

    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.

    +

    reference

    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.

    +

    reference

    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.

    +

    reference

    @@ -298,11 +322,13 @@ If "items" is a schema, validation succeeds if all elements in the array success 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 | Description | -| ----- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| items | FluentSchema \| Array.<FluentSchema> | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.1](reference) | +| Param | Type | +| ----- | -------------------------------------------------------------------- | +| items | FluentSchema \| Array.<FluentSchema> | @@ -310,11 +336,13 @@ Omitting this keyword has the same behavior as an empty schema. 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 | Description | -| ----- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| items | FluentSchema \| [boolean](#boolean) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.2](reference) | +| Param | Type | +| ----- | ------------------------------------------------------------- | +| items | FluentSchema \| [boolean](#boolean) | @@ -322,11 +350,13 @@ This keyword determines how child instances validate for arrays, and does not di 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 | Description | -| ----- | ------------------------- | ----------------------------------------------------------------------------------------- | -| value | FluentSchema | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.2](reference) | +| Param | Type | +| ----- | ------------------------- | +| value | FluentSchema | @@ -336,11 +366,13 @@ 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 | Description | -| ------- | -------------------------------- | ----------------------------------------------------------------------------------------- | -| boolean | [boolean](#boolean) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.5](reference) | +| Param | Type | +| ------- | -------------------------------- | +| boolean | [boolean](#boolean) | @@ -349,11 +381,13 @@ Omitting this keyword has the same behavior as a value of false. 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| min | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.4](reference) | +| Param | Type | +| ----- | ------------------------------ | +| min | [number](#number) | @@ -362,11 +396,13 @@ Omitting this keyword has the same behavior as a value of 0. 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| max | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.3](reference) | +| Param | Type | +| ----- | ------------------------------ | +| max | [number](#number) | @@ -388,7 +424,7 @@ Represents a BaseSchema. It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. -[reference](https://json-schema.org/latest/json-schema-core.html#id-keyword) +[reference](https://tools.ietf.org/html/draft-handrews-json-schema-01#section-8.2) **Kind**: global function @@ -402,7 +438,7 @@ It defines a URI for the schema, and the base URI that other URI references with 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://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1) **Kind**: global function @@ -418,7 +454,7 @@ 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://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1) **Kind**: global function @@ -433,7 +469,7 @@ the purpose of the instance described by the schema. The value of this keyword MUST be an array. There are no restrictions placed on the values within the array. -[reference](https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.4) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.4) **Kind**: global function @@ -459,7 +495,7 @@ The value must be a valid id e.g. #properties/foo 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](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.2) **Kind**: global function @@ -473,7 +509,7 @@ The value of this keyword MUST be an array. This array SHOULD have at least one 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](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.3) **Kind**: global function @@ -487,7 +523,7 @@ The value of this keyword MAY be of any type, including null. There are no restrictions placed on the value of this keyword. -[https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.2](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.2) **Kind**: global function @@ -500,9 +536,9 @@ There are no restrictions placed on the value of this keyword. ## 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 +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](#readOnly) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3) **Kind**: global function @@ -515,9 +551,9 @@ It takes an optional boolean which can be used to explicitly set readOnly true/f ## 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 +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](#writeOnly) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3) **Kind**: global function @@ -536,16 +572,31 @@ Examples: - S.prop('prop', S.number()).required() - S.required(['foo', 'bar']) -[https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3](reference) +[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. -[https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.2) **Kind**: global function @@ -559,7 +610,7 @@ It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema 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](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.1) **Kind**: global function @@ -573,11 +624,13 @@ It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema 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 | Description | -| ------- | ---------------------------- | ----------------------------------------------------------------------------------------- | -| schemas | [array](#array) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.2](reference) | +| Param | Type | +| ------- | ---------------------------- | +| schemas | [array](#array) | @@ -590,10 +643,10 @@ validation succeeds against this keyword if the instance also successfully valid **Kind**: global function -| Param | Type | Description | -| ---------- | -------------------------------------- | ----------------------------------------------------------------------------------------- | -| ifClause | [BaseSchema](#BaseSchema) | | -| thenClause | [BaseSchema](#BaseSchema) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.6.1](reference) | +| 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) | @@ -604,11 +657,11 @@ then validation succeeds against this keyword if the instance successfully valid **Kind**: global function -| Param | Type | Description | -| ---------- | -------------------------------------- | ----------------------------------------------------------------------------------------- | -| ifClause | [BaseSchema](#BaseSchema) | | -| thenClause | [BaseSchema](#BaseSchema) | | -| elseClause | [BaseSchema](#BaseSchema) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.6.1](reference) | +| 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) | @@ -624,9 +677,9 @@ it can be handy to arbitrary modify the schema injecting a fragment **Kind**: global function -| Param | Type | Description | -| -------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -| fragment | [string](#string) | an arbitrary JSON Schema to inject [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3](reference) | +| 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) | @@ -669,7 +722,7 @@ Represents a S. Set a property to type string -[https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3) **Kind**: global function @@ -678,7 +731,7 @@ Set a property to type string Set a property to type number -[https://json-schema.org/latest/json-schema-validation.html#numeric](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric) **Kind**: global function @@ -687,7 +740,7 @@ Set a property to type number Set a property to type integer -[https://json-schema.org/latest/json-schema-validation.html#numeric](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric) **Kind**: global function @@ -696,7 +749,7 @@ Set a property to type integer Set a property to type boolean -[https://json-schema.org/latest/json-schema-validation.html#general](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7) **Kind**: global function @@ -705,7 +758,7 @@ Set a property to type boolean Set a property to type array -[https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4) **Kind**: global function @@ -714,7 +767,7 @@ Set a property to type array Set a property to type object -[https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5) **Kind**: global function @@ -723,7 +776,7 @@ Set a property to type object Set a property to type null -[https://json-schema.org/latest/json-schema-validation.html#general](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#general) **Kind**: global function @@ -752,9 +805,9 @@ it can be handy to arbitrary modify the schema injecting a fragment **Kind**: global function -| Param | Type | Description | -| -------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -| fragment | [string](#string) | an arbitrary JSON Schema to inject [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3](reference) | +| Param | Type | Description | +| -------- | ------------------------------ | ---------------------------------- | +| fragment | [string](#string) | an arbitrary JSON Schema to inject | @@ -804,7 +857,7 @@ Represents a NullSchema. Set a property to type null -[https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.1) **Kind**: global function @@ -827,41 +880,55 @@ Represents a NumberSchema. 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| min | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4](reference) | +| Param | Type | +| ----- | ------------------------------ | +| min | [number](#number) | -## exclusiveMinimum() ⇒ FluentSchema +## exclusiveMinimum(min) ⇒ 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](reference) +[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) | -**Kind**: global function -## maximum() ⇒ FluentSchema +## maximum(max) ⇒ 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](reference) -**Kind**: global function +[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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| max | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.3](reference) | +| Param | Type | +| ----- | ------------------------------ | +| max | [number](#number) | @@ -869,11 +936,13 @@ It represents an exclusive upper limit for a numeric instance. 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 | Description | -| -------- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| multiple | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.1](reference) | +| Param | Type | +| -------- | ------------------------------ | +| multiple | [number](#number) | @@ -899,11 +968,13 @@ 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 | Description | -| ----- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| value | FluentSchema \| [boolean](#boolean) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.6](reference) | +| Param | Type | +| ----- | ------------------------------------------------------------- | +| value | FluentSchema \| [boolean](#boolean) | @@ -911,11 +982,13 @@ Omitting this keyword has the same behavior as an empty schema. 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| max | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.1](reference) | +| Param | Type | +| ----- | ------------------------------ | +| max | [number](#number) | @@ -923,11 +996,13 @@ An object instance is valid against "maxProperties" if its number of properties 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| min | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.2](reference) | +| Param | Type | +| ----- | ------------------------------ | +| min | [number](#number) | @@ -939,11 +1014,13 @@ This keyword determines how child instances validate for objects, and does not d 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| opts | [object](#object) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.5](reference) | +| Param | Type | +| ----- | ------------------------------ | +| opts | [object](#object) | @@ -954,11 +1031,13 @@ This keyword's value MUST be an object. Each property specifies a dependency. Ea 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| opts | [object](#object) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7](reference) | +| Param | Type | +| ----- | ------------------------------ | +| opts | [object](#object) | @@ -967,19 +1046,21 @@ If the dependency value is an array, each element in the array, if any, MUST be 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 | Description | -| ----- | ------------------------- | ----------------------------------------------------------------------------------------- | -| value | FluentSchema | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7](reference) | +| 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 +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](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.4) **Kind**: global function @@ -995,7 +1076,7 @@ The value of "properties" MUST be an object. Each value of this object MUST be a 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](reference) +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.9) **Kind**: global function @@ -1037,11 +1118,13 @@ Represents a 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| min | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.2](reference) | +| Param | Type | +| ----- | ------------------------------ | +| min | [number](#number) | @@ -1050,11 +1133,13 @@ The length of a string instance is defined as the number of its characters as de 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 | Description | -| ----- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| max | [number](#number) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.2](reference) | +| Param | Type | +| ----- | ------------------------------ | +| max | [number](#number) | @@ -1062,11 +1147,13 @@ The length of a string instance is defined as the number of its characters as de A string value can be RELATIVE_JSON_POINTER, JSON_POINTER, UUID, REGEX, IPV6, IPV4, HOSTNAME, EMAIL, URL, URI_TEMPLATE, URI_REFERENCE, URI, TIME, DATE, +[reference](https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.7.3) + **Kind**: global function -| Param | Type | Description | -| ------ | ------------------------------ | --------------------------------------------------------------------------------------- | -| format | [string](#string) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3](reference) | +| Param | Type | +| ------ | ------------------------------ | +| format | [string](#string) | @@ -1075,11 +1162,13 @@ A string value can be RELATIVE_JSON_POINTER, JSON_POINTER, UUID, REGEX, IPV6, IP 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 | Description | -| ------- | ------------------------------ | ----------------------------------------------------------------------------------------- | -| pattern | [string](#string) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3](reference) | +| Param | Type | +| ------- | ------------------------------ | +| pattern | [string](#string) | @@ -1089,11 +1178,13 @@ 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 | Description | -| -------- | ------------------------------ | --------------------------------------------------------------------------------------- | -| encoding | [string](#string) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3](reference) | +| Param | Type | +| -------- | ------------------------------ | +| encoding | [string](#string) | @@ -1102,8 +1193,10 @@ RFC 2045, Sec 6.1 [RFC2045] lists the possible values for this property. 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 | Description | -| --------- | ------------------------------ | --------------------------------------------------------------------------------------- | -| mediaType | [string](#string) | [https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3](reference) | +| Param | Type | +| --------- | ------------------------------ | +| mediaType | [string](#string) | diff --git a/src/ArraySchema.js b/src/ArraySchema.js index 18a6106..dffcbe3 100644 --- a/src/ArraySchema.js +++ b/src/ArraySchema.js @@ -34,8 +34,8 @@ const ArraySchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.1|reference} * @param {FluentSchema|FluentSchema[]} items - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.1} * @returns {FluentSchema} */ @@ -66,8 +66,8 @@ const ArraySchema = ({ schema = initialState, ...options } = {}) => { /** * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.2|reference} * @param {FluentSchema|boolean} items - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.2} * @returns {FluentSchema} */ @@ -94,8 +94,8 @@ const ArraySchema = ({ schema = initialState, ...options } = {}) => { /** * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.6|reference} * @param {FluentSchema} value - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.2} * @returns {FluentSchema} */ @@ -121,8 +121,8 @@ const ArraySchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.5|reference} * @param {boolean} boolean - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.5} * @returns {FluentSchema} */ @@ -140,8 +140,8 @@ const ArraySchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.4|reference} * @param {number} min - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.4} * @returns {FluentSchema} */ @@ -155,8 +155,8 @@ const ArraySchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.3|reference} * @param {number} max - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.3} * @returns {FluentSchema} */ diff --git a/src/BaseSchema.js b/src/BaseSchema.js index 0524195..3802c9b 100644 --- a/src/BaseSchema.js +++ b/src/BaseSchema.js @@ -38,7 +38,7 @@ const BaseSchema = ( /** * It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against. * - * {@link https://json-schema.org/latest/json-schema-core.html#id-keyword|reference} + * {@link https://tools.ietf.org/html/draft-handrews-json-schema-01#section-8.2|reference} * @param {string} id - an #id * @returns {BaseSchema} */ @@ -54,7 +54,7 @@ const 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. * - * {@link https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1|reference} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1|reference} * @param {string} title * @returns {BaseSchema} */ @@ -68,7 +68,7 @@ const BaseSchema = ( * produced by this user interface. A description provides explanation about * the purpose of the instance described by the schema. * - * {@link https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1|reference} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1|reference} * @param {string} description * @returns {BaseSchema} */ @@ -84,7 +84,7 @@ const BaseSchema = ( * The value of this keyword MUST be an array. * There are no restrictions placed on the values within the array. * - * {@link https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.4|reference} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.4|reference} * @param {string} examples * @returns {BaseSchema} */ @@ -111,7 +111,7 @@ const 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. * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.2|reference} * @param {array} values * @returns {BaseSchema} */ @@ -127,7 +127,7 @@ const BaseSchema = ( /** * The value of this keyword MAY be of any type, including null. * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.3} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.3|reference} * @param value * @returns {BaseSchema} */ @@ -139,7 +139,7 @@ const BaseSchema = ( /** * There are no restrictions placed on the value of this keyword. * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.2} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.2|reference} * @param defaults * @returns {BaseSchema} */ @@ -150,9 +150,9 @@ const 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 + * It takes an optional boolean which can be used to explicitly set readOnly true/false. * - * {@link readOnly|https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3|reference} * @param {boolean|undefined} isReadOnly * @returns {BaseSchema} */ @@ -164,9 +164,9 @@ const 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 + * It takes an optional boolean which can be used to explicitly set writeOnly true/false. * - * {@link writeOnly|https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3|reference} * @param {boolean|undefined} isWriteOnly * @returns {BaseSchema} */ @@ -183,7 +183,7 @@ const BaseSchema = ( * - S.prop('prop', S.number()).required() * - S.required(['foo', 'bar']) * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.3|reference} * @returns {FluentSchema} */ required: props => { @@ -199,6 +199,14 @@ const 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. + * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.4|reference} + * @param {FluentSchema} not + * @returns {BaseSchema} + */ not: not => { if (!isFluentSchema(not)) throw new FluentSchemaError("'not' must be a BaseSchema") @@ -219,9 +227,9 @@ const BaseSchema = ( // return setAttribute({ schema, ...options }, ['defaults', defaults, 'any']) /** - * It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. + * It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.3} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.2|reference} * @param {array} schemas * @returns {BaseSchema} */ @@ -231,7 +239,7 @@ const BaseSchema = ( /** * It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.1} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.1|reference} * @param {array} schemas * @returns {BaseSchema} */ @@ -241,19 +249,13 @@ const BaseSchema = ( /** * It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.3|reference} * @param {array} schemas - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7.2} * @returns {BaseSchema} */ oneOf: schemas => setComposeType({ prop: 'oneOf', schemas, schema, options }), - /** - * Set a property to type string - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1} - * @returns {BaseSchema} - */ - /** * @private set a property to a type. Use string number etc. * @returns {BaseSchema} @@ -267,8 +269,9 @@ const BaseSchema = ( * validation succeeds against this keyword if the instance also successfully validates against this keyword's subschema. * * @param {BaseSchema} ifClause + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.1|reference} * @param {BaseSchema} thenClause - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.6.1} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.2|reference} * @returns {BaseSchema} */ @@ -312,9 +315,11 @@ const BaseSchema = ( * then validation succeeds against this keyword if the instance successfully validates against this keyword's subschema. * * @param {BaseSchema} ifClause + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.1|reference} * @param {BaseSchema} thenClause + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.2|reference} * @param {BaseSchema} elseClause - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.6.1} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.3|reference} * @returns {BaseSchema} */ @@ -375,7 +380,7 @@ const BaseSchema = ( * - S.string().format('date').raw({ formatMaximum: '2020-01-01' }) * * @param {string} fragment an arbitrary JSON Schema to inject - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.3|reference} * @returns {BaseSchema} */ raw: fragment => { diff --git a/src/FluentSchema.js b/src/FluentSchema.js index 5dae3d4..1debd7f 100644 --- a/src/FluentSchema.js +++ b/src/FluentSchema.js @@ -39,7 +39,7 @@ const S = ( /** * Set a property to type string * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3|reference} * @returns {StringSchema} */ @@ -53,7 +53,7 @@ const S = ( /** * Set a property to type number * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#numeric} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric|reference} * @returns {NumberSchema} */ @@ -67,7 +67,7 @@ const S = ( /** * Set a property to type integer * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#numeric} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric|reference} * @returns {IntegerSchema} */ @@ -81,7 +81,7 @@ const S = ( /** * Set a property to type boolean * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#general} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7|reference} * @returns {BooleanSchema} */ @@ -95,7 +95,7 @@ const S = ( /** * Set a property to type array * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4|reference} * @returns {ArraySchema} */ @@ -109,7 +109,7 @@ const S = ( /** * Set a property to type object * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5|reference} * @returns {ObjectSchema} */ @@ -123,7 +123,7 @@ const S = ( /** * Set a property to type null * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#general} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#general|reference} * @returns {NullSchema} */ @@ -173,7 +173,6 @@ const S = ( * - S.string().format('date').raw({ formatMaximum: '2020-01-01' }) * * @param {string} fragment an arbitrary JSON Schema to inject - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3} * @returns {BaseSchema} */ diff --git a/src/NullSchema.js b/src/NullSchema.js index fc64bb4..8e83403 100644 --- a/src/NullSchema.js +++ b/src/NullSchema.js @@ -30,7 +30,7 @@ const NullSchema = ({ schema = initialState, ...options } = {}) => { /** * Set a property to type null * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.1|reference} * @returns {FluentSchema} */ null: () => setAttribute({ schema, ...options }, ['type', 'null']), diff --git a/src/NumberSchema.js b/src/NumberSchema.js index 1273be3..e847aa0 100644 --- a/src/NumberSchema.js +++ b/src/NumberSchema.js @@ -27,8 +27,8 @@ const NumberSchema = ( /** * It represents an inclusive lower limit for a numeric instance. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.4|reference} * @param {number} min - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4} * @returns {FluentSchema} */ @@ -43,8 +43,8 @@ const NumberSchema = ( /** * It represents an exclusive lower limit for a numeric instance. * - * * @param {number} min - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.5} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.5|reference} + * @param {number} min * @returns {FluentSchema} */ @@ -62,7 +62,9 @@ const NumberSchema = ( /** * It represents an inclusive upper limit for a numeric instance. - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2} + * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.2|reference} + * @param {number} max * @returns {FluentSchema} */ @@ -77,8 +79,8 @@ const NumberSchema = ( /** * It represents an exclusive upper limit for a numeric instance. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.3|reference} * @param {number} max - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.3} * @returns {FluentSchema} */ @@ -97,8 +99,8 @@ const NumberSchema = ( /** * It's strictly greater than 0. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.1|reference} * @param {number} multiple - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.1} * @returns {FluentSchema} */ diff --git a/src/ObjectSchema.js b/src/ObjectSchema.js index cbf7482..9561b71 100644 --- a/src/ObjectSchema.js +++ b/src/ObjectSchema.js @@ -43,8 +43,8 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.6|reference} * @param {FluentSchema|boolean} value - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.6} * @returns {FluentSchema} */ @@ -73,8 +73,8 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { /** * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.1|reference} * @param {number} max - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.1} * @returns {FluentSchema} */ @@ -91,8 +91,8 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { /** * An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, the value of this keyword. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.2|reference} * @param {number} min - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.2} * @returns {FluentSchema} */ @@ -113,8 +113,8 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.5|reference} * @param {object} opts - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.5} * @returns {FluentSchema} */ @@ -142,8 +142,8 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.7|reference} * @param {object} opts - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7} * @returns {FluentSchema} */ @@ -171,8 +171,8 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.8|reference} * @param {FluentSchema} value - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7} * @returns {FluentSchema} */ @@ -187,9 +187,9 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { }, /** - * The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema + * The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema. * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.4|reference} * @param {string} name * @param {FluentSchema} props * @returns {FluentSchema} @@ -274,7 +274,7 @@ const ObjectSchema = ({ schema = initialState, ...options } = {}) => { * 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. * - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.9} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.9|reference} * @param {string} name * @param {FluentSchema} props * @returns {FluentSchema} diff --git a/src/StringSchema.js b/src/StringSchema.js index e5e683e..c3aee12 100644 --- a/src/StringSchema.js +++ b/src/StringSchema.js @@ -27,7 +27,7 @@ const StringSchema = ( ...BaseSchema({ ...options, schema }), /*/!** * Set a property to type string - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1} + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3|reference} * @returns {StringSchema} *!/ @@ -38,8 +38,8 @@ const 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]. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.2|reference} * @param {number} min - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.2} * @returns {StringSchema} */ @@ -53,8 +53,8 @@ const 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]. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.1|reference} * @param {number} max - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.2} * @returns {StringSchema} */ @@ -67,8 +67,8 @@ const 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, * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.7.3|reference} * @param {string} format - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3} * @returns {StringSchema} */ @@ -84,8 +84,8 @@ const 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.3|reference} * @param {string} pattern - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3} * @returns {StringSchema} */ pattern: pattern => { @@ -110,8 +110,8 @@ const StringSchema = ( * 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.8.3|reference} * @param {string} encoding - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3} * @returns {StringSchema} */ @@ -129,8 +129,8 @@ const 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. * + * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.8.4|reference} * @param {string} mediaType - * {@link reference|https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3} * @returns {StringSchema} */