@types/json-schema
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
// Type definitions for json-schema 4.0 and 6.0 | ||
// Type definitions for json-schema 4.0, 6.0 and 7.0 | ||
// Project: https://www.npmjs.com/package/json-schema | ||
@@ -6,2 +6,3 @@ // Definitions by: Boris Cherny <https://github.com/bcherny> | ||
// Lucian Buzzo <https://github.com/lucianbuzzo> | ||
// Roland Groza <https://github.com/rolandjitsu> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -16,3 +17,3 @@ // TypeScript Version: 2.2 | ||
export type JSONSchema4TypeName = 'string' | 'number' | 'integer' | 'boolean' | ||
| 'object' | 'array' | 'null' | 'any' | ||
| 'object' | 'array' | 'null' | 'any' | ||
@@ -29,179 +30,179 @@ /** | ||
export interface JSONSchema4 { | ||
id?: string | ||
$ref?: string | ||
$schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | ||
| 'http://json-schema.org/draft-04/schema#' | 'http://json-schema.org/draft-04/hyper-schema#' | ||
| 'http://json-schema.org/draft-03/schema#' | 'http://json-schema.org/draft-03/hyper-schema#' | ||
| string | ||
id?: string | ||
$ref?: string | ||
$schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | ||
| 'http://json-schema.org/draft-04/schema#' | 'http://json-schema.org/draft-04/hyper-schema#' | ||
| 'http://json-schema.org/draft-03/schema#' | 'http://json-schema.org/draft-03/hyper-schema#' | ||
| string | ||
/** | ||
* This attribute is a string that provides a short description of the | ||
* instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21 | ||
*/ | ||
title?: string | ||
/** | ||
* This attribute is a string that provides a short description of the | ||
* instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21 | ||
*/ | ||
title?: string | ||
/** | ||
* This attribute is a string that provides a full description of the of | ||
* purpose the instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22 | ||
*/ | ||
description?: string | ||
/** | ||
* This attribute is a string that provides a full description of the of | ||
* purpose the instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22 | ||
*/ | ||
description?: string | ||
default?: JSONSchema4Type | ||
multipleOf?: number | ||
maximum?: number | ||
exclusiveMaximum?: boolean | ||
minimum?: number | ||
exclusiveMinimum?: boolean | ||
maxLength?: number | ||
minLength?: number | ||
pattern?: string | ||
default?: JSONSchema4Type | ||
multipleOf?: number | ||
maximum?: number | ||
exclusiveMaximum?: boolean | ||
minimum?: number | ||
exclusiveMinimum?: boolean | ||
maxLength?: number | ||
minLength?: number | ||
pattern?: string | ||
/** | ||
* May only be defined when "items" is defined, and is a tuple of JSONSchemas. | ||
* | ||
* This provides a definition for additional items in an array instance | ||
* when tuple definitions of the items is provided. This can be false | ||
* to indicate additional items in the array are not allowed, or it can | ||
* be a schema that defines the schema of the additional items. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6 | ||
*/ | ||
additionalItems?: boolean | JSONSchema4 | ||
/** | ||
* May only be defined when "items" is defined, and is a tuple of JSONSchemas. | ||
* | ||
* This provides a definition for additional items in an array instance | ||
* when tuple definitions of the items is provided. This can be false | ||
* to indicate additional items in the array are not allowed, or it can | ||
* be a schema that defines the schema of the additional items. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6 | ||
*/ | ||
additionalItems?: boolean | JSONSchema4 | ||
/** | ||
* This attribute defines the allowed items in an instance array, and | ||
* MUST be a schema or an array of schemas. The default value is an | ||
* empty schema which allows any value for items in the instance array. | ||
* | ||
* When this attribute value is a schema and the instance value is an | ||
* array, then all the items in the array MUST be valid according to the | ||
* schema. | ||
* | ||
* When this attribute value is an array of schemas and the instance | ||
* value is an array, each position in the instance array MUST conform | ||
* to the schema in the corresponding position for this array. This | ||
* called tuple typing. When tuple typing is used, additional items are | ||
* allowed, disallowed, or constrained by the "additionalItems" | ||
* (Section 5.6) attribute using the same rules as | ||
* "additionalProperties" (Section 5.4) for objects. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5 | ||
*/ | ||
items?: JSONSchema4 | JSONSchema4[] | ||
/** | ||
* This attribute defines the allowed items in an instance array, and | ||
* MUST be a schema or an array of schemas. The default value is an | ||
* empty schema which allows any value for items in the instance array. | ||
* | ||
* When this attribute value is a schema and the instance value is an | ||
* array, then all the items in the array MUST be valid according to the | ||
* schema. | ||
* | ||
* When this attribute value is an array of schemas and the instance | ||
* value is an array, each position in the instance array MUST conform | ||
* to the schema in the corresponding position for this array. This | ||
* called tuple typing. When tuple typing is used, additional items are | ||
* allowed, disallowed, or constrained by the "additionalItems" | ||
* (Section 5.6) attribute using the same rules as | ||
* "additionalProperties" (Section 5.4) for objects. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5 | ||
*/ | ||
items?: JSONSchema4 | JSONSchema4[] | ||
maxItems?: number | ||
minItems?: number | ||
uniqueItems?: boolean | ||
maxProperties?: number | ||
minProperties?: number | ||
maxItems?: number | ||
minItems?: number | ||
uniqueItems?: boolean | ||
maxProperties?: number | ||
minProperties?: number | ||
/** | ||
* This attribute indicates if the instance must have a value, and not | ||
* be undefined. This is false by default, making the instance | ||
* optional. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7 | ||
*/ | ||
required?: false | string[] | ||
/** | ||
* This attribute indicates if the instance must have a value, and not | ||
* be undefined. This is false by default, making the instance | ||
* optional. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7 | ||
*/ | ||
required?: false | string[] | ||
/** | ||
* This attribute defines a schema for all properties that are not | ||
* explicitly defined in an object type definition. If specified, the | ||
* value MUST be a schema or a boolean. If false is provided, no | ||
* additional properties are allowed beyond the properties defined in | ||
* the schema. The default value is an empty schema which allows any | ||
* value for additional properties. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4 | ||
*/ | ||
additionalProperties?: boolean | JSONSchema4 | ||
/** | ||
* This attribute defines a schema for all properties that are not | ||
* explicitly defined in an object type definition. If specified, the | ||
* value MUST be a schema or a boolean. If false is provided, no | ||
* additional properties are allowed beyond the properties defined in | ||
* the schema. The default value is an empty schema which allows any | ||
* value for additional properties. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4 | ||
*/ | ||
additionalProperties?: boolean | JSONSchema4 | ||
definitions?: { | ||
[k: string]: JSONSchema4 | ||
} | ||
definitions?: { | ||
[k: string]: JSONSchema4 | ||
} | ||
/** | ||
* This attribute is an object with property definitions that define the | ||
* valid values of instance object property values. When the instance | ||
* value is an object, the property values of the instance object MUST | ||
* conform to the property definitions in this object. In this object, | ||
* each property definition's value MUST be a schema, and the property's | ||
* name MUST be the name of the instance property that it defines. The | ||
* instance property value MUST be valid according to the schema from | ||
* the property definition. Properties are considered unordered, the | ||
* order of the instance properties MAY be in any order. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2 | ||
*/ | ||
properties?: { | ||
[k: string]: JSONSchema4 | ||
} | ||
/** | ||
* This attribute is an object with property definitions that define the | ||
* valid values of instance object property values. When the instance | ||
* value is an object, the property values of the instance object MUST | ||
* conform to the property definitions in this object. In this object, | ||
* each property definition's value MUST be a schema, and the property's | ||
* name MUST be the name of the instance property that it defines. The | ||
* instance property value MUST be valid according to the schema from | ||
* the property definition. Properties are considered unordered, the | ||
* order of the instance properties MAY be in any order. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2 | ||
*/ | ||
properties?: { | ||
[k: string]: JSONSchema4 | ||
} | ||
/** | ||
* This attribute is an object that defines the schema for a set of | ||
* property names of an object instance. The name of each property of | ||
* this attribute's object is a regular expression pattern in the ECMA | ||
* 262/Perl 5 format, while the value is a schema. If the pattern | ||
* matches the name of a property on the instance object, the value of | ||
* the instance's property MUST be valid against the pattern name's | ||
* schema value. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3 | ||
*/ | ||
patternProperties?: { | ||
[k: string]: JSONSchema4 | ||
} | ||
dependencies?: { | ||
[k: string]: JSONSchema4 | string[] | ||
} | ||
/** | ||
* This attribute is an object that defines the schema for a set of | ||
* property names of an object instance. The name of each property of | ||
* this attribute's object is a regular expression pattern in the ECMA | ||
* 262/Perl 5 format, while the value is a schema. If the pattern | ||
* matches the name of a property on the instance object, the value of | ||
* the instance's property MUST be valid against the pattern name's | ||
* schema value. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3 | ||
*/ | ||
patternProperties?: { | ||
[k: string]: JSONSchema4 | ||
} | ||
dependencies?: { | ||
[k: string]: JSONSchema4 | string[] | ||
} | ||
/** | ||
* This provides an enumeration of all possible values that are valid | ||
* for the instance property. This MUST be an array, and each item in | ||
* the array represents a possible value for the instance value. If | ||
* this attribute is defined, the instance value MUST be one of the | ||
* values in the array in order for the schema to be valid. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 | ||
*/ | ||
enum?: JSONSchema4Type[] | ||
/** | ||
* This provides an enumeration of all possible values that are valid | ||
* for the instance property. This MUST be an array, and each item in | ||
* the array represents a possible value for the instance value. If | ||
* this attribute is defined, the instance value MUST be one of the | ||
* values in the array in order for the schema to be valid. | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 | ||
*/ | ||
enum?: JSONSchema4Type[] | ||
/** | ||
* A single type, or a union of simple types | ||
*/ | ||
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | ||
/** | ||
* A single type, or a union of simple types | ||
*/ | ||
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | ||
allOf?: JSONSchema4[] | ||
anyOf?: JSONSchema4[] | ||
oneOf?: JSONSchema4[] | ||
not?: JSONSchema4 | ||
allOf?: JSONSchema4[] | ||
anyOf?: JSONSchema4[] | ||
oneOf?: JSONSchema4[] | ||
not?: JSONSchema4 | ||
/** | ||
* The value of this property MUST be another schema which will provide | ||
* a base schema which the current schema will inherit from. The | ||
* inheritance rules are such that any instance that is valid according | ||
* to the current schema MUST be valid according to the referenced | ||
* schema. This MAY also be an array, in which case, the instance MUST | ||
* be valid for all the schemas in the array. A schema that extends | ||
* another schema MAY define additional attributes, constrain existing | ||
* attributes, or add other constraints. | ||
* | ||
* Conceptually, the behavior of extends can be seen as validating an | ||
* instance against all constraints in the extending schema as well as | ||
* the extended schema(s). | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26 | ||
*/ | ||
extends?: string | string[] | ||
/** | ||
* The value of this property MUST be another schema which will provide | ||
* a base schema which the current schema will inherit from. The | ||
* inheritance rules are such that any instance that is valid according | ||
* to the current schema MUST be valid according to the referenced | ||
* schema. This MAY also be an array, in which case, the instance MUST | ||
* be valid for all the schemas in the array. A schema that extends | ||
* another schema MAY define additional attributes, constrain existing | ||
* attributes, or add other constraints. | ||
* | ||
* Conceptually, the behavior of extends can be seen as validating an | ||
* instance against all constraints in the extending schema as well as | ||
* the extended schema(s). | ||
* | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26 | ||
*/ | ||
extends?: string | string[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6 | ||
*/ | ||
[k: string]: any | ||
/** | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6 | ||
*/ | ||
[k: string]: any | ||
format?: string | ||
format?: string | ||
} | ||
@@ -220,267 +221,394 @@ | ||
export interface JSONSchema6 { | ||
$id?: string | ||
$ref?: string | ||
$schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | | ||
'http://json-schema.org/draft-06/schema#' | 'http://json-schema.org/draft-06/hyper-schema#' | ||
$id?: string | ||
$ref?: string | ||
$schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | | ||
'http://json-schema.org/draft-06/schema#' | 'http://json-schema.org/draft-06/hyper-schema#' | ||
/** | ||
* Must be strictly greater than 0. | ||
* A numeric instance is valid only if division by this keyword's value results in an integer. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1 | ||
*/ | ||
multipleOf?: number | ||
/** | ||
* Must be strictly greater than 0. | ||
* A numeric instance is valid only if division by this keyword's value results in an integer. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1 | ||
*/ | ||
multipleOf?: number | ||
/** | ||
* Representing an inclusive upper limit for a numeric instance. | ||
* This keyword validates only if the instance is less than or exactly equal to "maximum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2 | ||
*/ | ||
maximum?: number | ||
/** | ||
* Representing an inclusive upper limit for a numeric instance. | ||
* This keyword validates only if the instance is less than or exactly equal to "maximum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2 | ||
*/ | ||
maximum?: number | ||
/** | ||
* Representing an exclusive upper limit for a numeric instance. | ||
* This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3 | ||
*/ | ||
exclusiveMaximum?: number | ||
/** | ||
* Representing an exclusive upper limit for a numeric instance. | ||
* This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3 | ||
*/ | ||
exclusiveMaximum?: number | ||
/** | ||
* Representing an inclusive lower limit for a numeric instance. | ||
* This keyword validates only if the instance is greater than or exactly equal to "minimum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4 | ||
*/ | ||
minimum?: number | ||
/** | ||
* Representing an inclusive lower limit for a numeric instance. | ||
* This keyword validates only if the instance is greater than or exactly equal to "minimum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4 | ||
*/ | ||
minimum?: number | ||
/** | ||
* Representing an exclusive lower limit for a numeric instance. | ||
* This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5 | ||
*/ | ||
exclusiveMinimum?: number | ||
/** | ||
* Representing an exclusive lower limit for a numeric instance. | ||
* This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum". | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5 | ||
*/ | ||
exclusiveMinimum?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6 | ||
*/ | ||
maxLength?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6 | ||
*/ | ||
maxLength?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. | ||
* Omitting this keyword has the same behavior as a value of 0. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7 | ||
*/ | ||
minLength?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. | ||
* Omitting this keyword has the same behavior as a value of 0. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7 | ||
*/ | ||
minLength?: number | ||
/** | ||
* Should be a valid regular expression, according to the ECMA 262 regular expression dialect. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8 | ||
*/ | ||
pattern?: string | ||
/** | ||
* Should be a valid regular expression, according to the ECMA 262 regular expression dialect. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8 | ||
*/ | ||
pattern?: string | ||
/** | ||
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. | ||
* Omitting this keyword has the same behavior as an empty schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 | ||
*/ | ||
items?: boolean | JSONSchema6 | JSONSchema6[] | ||
/** | ||
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. | ||
* Omitting this keyword has the same behavior as an empty schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 | ||
*/ | ||
items?: boolean | JSONSchema6 | JSONSchema6[] | ||
/** | ||
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. | ||
* If "items" is an array of schemas, validation succeeds if every instance element | ||
* at a position greater than the size of "items" validates against "additionalItems". | ||
* Otherwise, "additionalItems" MUST be ignored, as the "items" schema | ||
* (possibly the default value of an empty schema) is applied to all elements. | ||
* Omitting this keyword has the same behavior as an empty schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 | ||
*/ | ||
additionalItems?: boolean | JSONSchema6 | ||
/** | ||
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. | ||
* If "items" is an array of schemas, validation succeeds if every instance element | ||
* at a position greater than the size of "items" validates against "additionalItems". | ||
* Otherwise, "additionalItems" MUST be ignored, as the "items" schema | ||
* (possibly the default value of an empty schema) is applied to all elements. | ||
* Omitting this keyword has the same behavior as an empty schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 | ||
*/ | ||
additionalItems?: boolean | JSONSchema6 | ||
/** | ||
* Must be a non-negative integer. | ||
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11 | ||
*/ | ||
maxItems?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11 | ||
*/ | ||
maxItems?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* An array instance is valid against "maxItems" 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. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12 | ||
*/ | ||
minItems?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* An array instance is valid against "maxItems" 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. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12 | ||
*/ | ||
minItems?: number | ||
/** | ||
* 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. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13 | ||
*/ | ||
uniqueItems?: boolean | ||
/** | ||
* 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. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13 | ||
*/ | ||
uniqueItems?: boolean | ||
/** | ||
* An array instance is valid against "contains" if at least one of its elements is valid against the given schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 | ||
*/ | ||
contains?: boolean | JSONSchema6 | ||
/** | ||
* An array instance is valid against "contains" if at least one of its elements is valid against the given schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 | ||
*/ | ||
contains?: boolean | JSONSchema6 | ||
/** | ||
* Must be a non-negative integer. | ||
* An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15 | ||
*/ | ||
maxProperties?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15 | ||
*/ | ||
maxProperties?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* An object instance is valid against "maxProperties" if its number of properties is greater than, | ||
* or equal to, the value of this keyword. | ||
* Omitting this keyword has the same behavior as a value of 0. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16 | ||
*/ | ||
minProperties?: number | ||
/** | ||
* Must be a non-negative integer. | ||
* An object instance is valid against "maxProperties" if its number of properties is greater than, | ||
* or equal to, the value of this keyword. | ||
* Omitting this keyword has the same behavior as a value of 0. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16 | ||
*/ | ||
minProperties?: number | ||
/** | ||
* Elements of this array must be unique. | ||
* An object instance is valid against this keyword if every item in the array is the name of a property in the instance. | ||
* Omitting this keyword has the same behavior as an empty array. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17 | ||
*/ | ||
required?: string[] | ||
/** | ||
* Elements of this array must be unique. | ||
* An object instance is valid against this keyword if every item in the array is the name of a property in the instance. | ||
* Omitting this keyword has the same behavior as an empty array. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17 | ||
*/ | ||
required?: string[] | ||
/** | ||
* This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. | ||
* Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, | ||
* the child instance for that name successfully validates against the corresponding schema. | ||
* Omitting this keyword has the same behavior as an empty object. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18 | ||
*/ | ||
properties?: { | ||
[k: string]: boolean | JSONSchema6 | ||
} | ||
/** | ||
* This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. | ||
* Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, | ||
* the child instance for that name successfully validates against the corresponding schema. | ||
* Omitting this keyword has the same behavior as an empty object. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18 | ||
*/ | ||
properties?: { | ||
[k: string]: boolean | JSONSchema6 | ||
} | ||
/** | ||
* This attribute is an object that defines the schema for a set of property names of an object instance. | ||
* The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema. | ||
* If the pattern matches the name of a property on the instance object, the value of the instance's property | ||
* MUST be valid against the pattern name's schema value. | ||
* Omitting this keyword has the same behavior as an empty object. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19 | ||
*/ | ||
patternProperties?: { | ||
[k: string]: boolean | JSONSchema6 | ||
} | ||
/** | ||
* This attribute is an object that defines the schema for a set of property names of an object instance. | ||
* The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema. | ||
* If the pattern matches the name of a property on the instance object, the value of the instance's property | ||
* MUST be valid against the pattern name's schema value. | ||
* Omitting this keyword has the same behavior as an empty object. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19 | ||
*/ | ||
patternProperties?: { | ||
[k: string]: boolean | JSONSchema6 | ||
} | ||
/** | ||
* This attribute defines a schema for all properties that are not explicitly defined in an object type definition. | ||
* If specified, the value MUST be a schema or a boolean. | ||
* If false is provided, no additional properties are allowed beyond the properties defined in the schema. | ||
* The default value is an empty schema which allows any value for additional properties. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 | ||
*/ | ||
additionalProperties?: boolean | JSONSchema6 | ||
/** | ||
* This attribute defines a schema for all properties that are not explicitly defined in an object type definition. | ||
* If specified, the value MUST be a schema or a boolean. | ||
* If false is provided, no additional properties are allowed beyond the properties defined in the schema. | ||
* The default value is an empty schema which allows any value for additional properties. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 | ||
*/ | ||
additionalProperties?: boolean | JSONSchema6 | ||
/** | ||
* This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. | ||
* Each property specifies a dependency. | ||
* If the dependency value is an array, each element in the array must be unique. | ||
* Omitting this keyword has the same behavior as an empty object. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21 | ||
*/ | ||
dependencies?: { | ||
[k: string]: boolean | JSONSchema6 | string[] | ||
} | ||
/** | ||
* This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. | ||
* Each property specifies a dependency. | ||
* If the dependency value is an array, each element in the array must be unique. | ||
* Omitting this keyword has the same behavior as an empty object. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21 | ||
*/ | ||
dependencies?: { | ||
[k: string]: boolean | JSONSchema6 | string[] | ||
} | ||
/** | ||
* Takes a schema which validates the names of all properties rather than their values. | ||
* Note the property name that the schema is testing will always be a string. | ||
* Omitting this keyword has the same behavior as an empty schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 | ||
*/ | ||
propertyNames?: boolean | JSONSchema6 | ||
/** | ||
* Takes a schema which validates the names of all properties rather than their values. | ||
* Note the property name that the schema is testing will always be a string. | ||
* Omitting this keyword has the same behavior as an empty schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 | ||
*/ | ||
propertyNames?: boolean | JSONSchema6 | ||
/** | ||
* This provides an enumeration of all possible values that are valid | ||
* for the instance property. This MUST be an array, and each item in | ||
* the array represents a possible value for the instance value. If | ||
* this attribute is defined, the instance value MUST be one of the | ||
* values in the array in order for the schema to be valid. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23 | ||
*/ | ||
enum?: JSONSchema6Type[] | ||
/** | ||
* This provides an enumeration of all possible values that are valid | ||
* for the instance property. This MUST be an array, and each item in | ||
* the array represents a possible value for the instance value. If | ||
* this attribute is defined, the instance value MUST be one of the | ||
* values in the array in order for the schema to be valid. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23 | ||
*/ | ||
enum?: JSONSchema6Type[] | ||
/** | ||
* More readible form of a one-element "enum" | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24 | ||
*/ | ||
const?: JSONSchema6Type | ||
/** | ||
* More readible form of a one-element "enum" | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24 | ||
*/ | ||
const?: JSONSchema6Type | ||
/** | ||
* A single type, or a union of simple types | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25 | ||
*/ | ||
type?: JSONSchema6TypeName | JSONSchema6TypeName[] | ||
/** | ||
* A single type, or a union of simple types | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25 | ||
*/ | ||
type?: JSONSchema6TypeName | JSONSchema6TypeName[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26 | ||
*/ | ||
allOf?: JSONSchema6[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26 | ||
*/ | ||
allOf?: JSONSchema6[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27 | ||
*/ | ||
anyOf?: JSONSchema6[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27 | ||
*/ | ||
anyOf?: JSONSchema6[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28 | ||
*/ | ||
oneOf?: JSONSchema6[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28 | ||
*/ | ||
oneOf?: JSONSchema6[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 | ||
*/ | ||
not?: boolean | JSONSchema6 | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 | ||
*/ | ||
not?: boolean | JSONSchema6 | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 | ||
*/ | ||
definitions?: { | ||
[k: string]: boolean | JSONSchema6 | ||
} | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 | ||
*/ | ||
definitions?: { | ||
[k: string]: boolean | JSONSchema6 | ||
} | ||
/** | ||
* This attribute is a string that provides a short description of the instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 | ||
*/ | ||
title?: string | ||
/** | ||
* This attribute is a string that provides a short description of the instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 | ||
*/ | ||
title?: string | ||
/** | ||
* This attribute is a string that provides a full description of the of purpose the instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 | ||
*/ | ||
description?: string | ||
/** | ||
* This attribute is a string that provides a full description of the of purpose the instance property. | ||
* | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 | ||
*/ | ||
description?: string | ||
/** | ||
* This keyword can be used to supply a default JSON value associated with a particular schema. | ||
* It is RECOMMENDED that a default value be valid against the associated schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3 | ||
*/ | ||
default?: JSONSchema6Type | ||
/** | ||
* This keyword can be used to supply a default JSON value associated with a particular schema. | ||
* It is RECOMMENDED that a default value be valid against the associated schema. | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3 | ||
*/ | ||
default?: JSONSchema6Type | ||
/** | ||
* Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4 | ||
*/ | ||
examples?: JSONSchema6Type[] | ||
/** | ||
* Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4 | ||
*/ | ||
examples?: JSONSchema6Type[] | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8 | ||
*/ | ||
format?: string | ||
/** | ||
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8 | ||
*/ | ||
format?: string | ||
} | ||
/** | ||
* JSON Schema 7 | ||
* Draft 07 | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01 | ||
*/ | ||
/** | ||
* Primitive type | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1 | ||
*/ | ||
export type JSONSchema7TypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null'; | ||
export type JSONSchema7Type = JSONSchema7Array[] | boolean | number | null | object | string; | ||
// Workaround for infinite type recursion | ||
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540 | ||
export interface JSONSchema7Array extends Array<JSONSchema7Type> {} | ||
/** | ||
* Meta schema | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5 | ||
*/ | ||
export type JSONSchema7Version = 'http://json-schema.org/schema#' | ||
| 'http://json-schema.org/hyper-schema#' | ||
| 'http://json-schema.org/draft-07/schema#' | ||
| 'http://json-schema.org/draft-07/hyper-schema#'; | ||
export interface JSONSchema7 { | ||
$id?: string; | ||
$ref?: string; | ||
$schema?: JSONSchema7Version; | ||
$comment?: string; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1 | ||
*/ | ||
type?: JSONSchema7TypeName | JSONSchema7TypeName[]; | ||
enum?: JSONSchema7Type[]; | ||
const?: JSONSchema7Type; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2 | ||
*/ | ||
multipleOf?: number; | ||
maximum?: number; | ||
exclusiveMaximum?: number; | ||
minimum?: number; | ||
exclusiveMinimum?: number; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3 | ||
*/ | ||
maxLength?: number; | ||
minLength?: number; | ||
pattern?: string; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4 | ||
*/ | ||
items?: JSONSchema7 | JSONSchema7[]; | ||
additionalItems?: JSONSchema7; | ||
maxItems?: number; | ||
minItems?: number; | ||
uniqueItems?: boolean; | ||
contains?: JSONSchema7; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5 | ||
*/ | ||
maxProperties?: number; | ||
minProperties?: number; | ||
required?: string[]; | ||
properties?: { | ||
[key: string]: JSONSchema7; | ||
}; | ||
patternProperties?: { | ||
[key: string]: JSONSchema7; | ||
}; | ||
additionalProperties?: JSONSchema7; | ||
dependencies?: { | ||
[key: string]: JSONSchema7 | string[]; | ||
}; | ||
propertyNames?: JSONSchema7; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6 | ||
*/ | ||
if?: JSONSchema7; | ||
then?: JSONSchema7; | ||
else?: JSONSchema7; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7 | ||
*/ | ||
allOf?: JSONSchema7[]; | ||
anyOf?: JSONSchema7[]; | ||
oneOf?: JSONSchema7[]; | ||
not?: JSONSchema7; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7 | ||
*/ | ||
format?: string; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8 | ||
*/ | ||
contentMediaType?: string; | ||
contentEncoding?: string; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9 | ||
*/ | ||
definitions?: { | ||
[key: string]: JSONSchema7; | ||
}; | ||
/** | ||
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10 | ||
*/ | ||
title?: string; | ||
description?: string; | ||
default?: JSONSchema7Type; | ||
readOnly?: boolean; | ||
writeOnly?: boolean; | ||
examples?: JSONSchema7Type; | ||
} |
{ | ||
"name": "@types/json-schema", | ||
"version": "6.0.1", | ||
"description": "TypeScript definitions for json-schema 4.0 and", | ||
"version": "7.0.0", | ||
"description": "TypeScript definitions for json-schema 4.0, 6.0 and", | ||
"license": "MIT", | ||
@@ -21,2 +21,7 @@ "contributors": [ | ||
"githubUsername": "lucianbuzzo" | ||
}, | ||
{ | ||
"name": "Roland Groza", | ||
"url": "https://github.com/rolandjitsu", | ||
"githubUsername": "rolandjitsu" | ||
} | ||
@@ -27,8 +32,8 @@ ], | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
}, | ||
"scripts": {}, | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "5c07b3f559a36032852670dda7149875d6a81180ce537279d154d550556fb348", | ||
"typesPublisherContentHash": "ef0c5629d4da15a4e911b66ec83ecbe8f9da2c530a7304d78924ca62637b2ba8", | ||
"typeScriptVersion": "2.2" | ||
} |
@@ -5,9 +5,9 @@ # Installation | ||
# Summary | ||
This package contains type definitions for json-schema 4.0 and (https://www.npmjs.com/package/json-schema). | ||
This package contains type definitions for json-schema 4.0, 6.0 and (https://www.npmjs.com/package/json-schema). | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema | ||
Additional Details | ||
* Last updated: Thu, 15 Mar 2018 23:17:55 GMT | ||
* Last updated: Wed, 25 Jul 2018 01:26:51 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Boris Cherny <https://github.com/bcherny>, Cyrille Tuzi <https://github.com/cyrilletuzi>, Lucian Buzzo <https://github.com/lucianbuzzo>. | ||
These definitions were written by Boris Cherny <https://github.com/bcherny>, Cyrille Tuzi <https://github.com/cyrilletuzi>, Lucian Buzzo <https://github.com/lucianbuzzo>, Roland Groza <https://github.com/rolandjitsu>. |
26327
21.33%534
26.54%