UNPKG

33.7 kBTypeScriptView Raw
1/**
2 * JSON Schema
3 *
4 * Documentation corresponds to the work-in-progress draft-07 of JSON Schema.
5 *
6 * The latest published drafts are:
7 * - draft-handrews-json-schema-01
8 * - draft-handrews-json-schema-validation-01
9 *
10 * For more information, visit: http://json-schema.org/.
11 *
12 * Draft date: March 19, 2018.
13 *
14 * @public
15 */
16export interface JSONSchema {
17 /**
18 * This keyword is reserved for comments from schema authors to readers or
19 * maintainers of the schema. The value of this keyword MUST be a string.
20 * Implementations MUST NOT present this string to end users. Tools for
21 * editing schemas SHOULD support displaying and editing this keyword.
22 *
23 * The value of this keyword MAY be used in debug or error output which is
24 * intended for developers making use of schemas. Schema vocabularies SHOULD
25 * allow "$comment" within any object containing vocabulary keywords.
26 *
27 * Implementations MAY assume "$comment" is allowed unless the vocabulary
28 * specifically forbids it. Vocabularies MUST NOT specify any effect of
29 * "$comment" beyond what is described in this specification. Tools that
30 * translate other media types or programming languages to and from
31 * application/schema+json MAY choose to convert that media type or
32 * programming language's native comments to or from "$comment" values.
33 *
34 * The behavior of such translation when both native comments and "$comment"
35 * properties are present is implementation-dependent. Implementations SHOULD
36 * treat "$comment" identically to an unknown extension keyword.
37 *
38 * They MAY strip "$comment" values at any point during processing. In
39 * particular, this allows for shortening schemas when the size of deployed
40 * schemas is a concern. Implementations MUST NOT take any other action based
41 * on the presence, absence, or contents of "$comment" properties.
42 */
43 $comment?: string
44 /**
45 * The "$id" keyword defines a URI for the schema, and the base URI that other
46 * URI references within the schema are resolved against. A subschema's "$id"
47 * is resolved against the base URI of its parent schema. If no parent sets an
48 * explicit base with "$id", the base URI is that of the entire document, as
49 * determined per [RFC 3986 section 5][RFC3986].
50 *
51 * If present, the value for this keyword MUST be a string, and MUST represent
52 * a valid [URI-reference][RFC3986]. This value SHOULD be normalized, and
53 * SHOULD NOT be an empty fragment <#> or an empty string <>.
54 *
55 * [RFC3986]: http://json-schema.org/latest/json-schema-core.html#RFC3986
56 */
57 $id?: string
58 /**
59 * The "$ref" keyword is used to reference a schema, and provides the ability
60 * to validate recursive structures through self-reference.
61 *
62 * An object schema with a "$ref" property MUST be interpreted as a "$ref"
63 * reference. The value of the "$ref" property MUST be a URI Reference.
64 * Resolved against the current URI base, it identifies the URI of a schema to
65 * use. All other properties in a "$ref" object MUST be ignored.
66 *
67 * The URI is not a network locator, only an identifier. A schema need not be
68 * downloadable from the address if it is a network-addressable URL, and
69 * implementations SHOULD NOT assume they should perform a network operation
70 * when they encounter a network-addressable URI.
71 *
72 * A schema MUST NOT be run into an infinite loop against a schema. For
73 * example, if two schemas "#alice" and "#bob" both have an "allOf" property
74 * that refers to the other, a naive validator might get stuck in an infinite
75 * recursive loop trying to validate the instance. Schemas SHOULD NOT make use
76 * of infinite recursive nesting like this; the behavior is undefined.
77 */
78 $ref?: string
79 /**
80 * The "$schema" keyword is both used as a JSON Schema version identifier and
81 * the location of a resource which is itself a JSON Schema, which describes
82 * any schema written for this particular version.
83 *
84 * The value of this keyword MUST be a [URI][RFC3986] (containing a scheme)
85 * and this URI MUST be normalized. The current schema MUST be valid against
86 * the meta-schema identified by this URI.
87 *
88 * If this URI identifies a retrievable resource, that resource SHOULD be of
89 * media type "application/schema+json".
90 *
91 * The "$schema" keyword SHOULD be used in a root schema. It MUST NOT appear
92 * in subschemas.
93 *
94 * Values for this property are defined in other documents and by other
95 * parties. JSON Schema implementations SHOULD implement support for current
96 * and previous published drafts of JSON Schema vocabularies as deemed
97 * reasonable.
98 *
99 * [RFC3986]: http://json-schema.org/latest/json-schema-core.html#RFC3986
100 */
101 $schema?: string
102 /**
103 * The value of "additionalItems" MUST be a valid JSON Schema.
104 *
105 * This keyword determines how child instances validate for arrays, and does
106 * not directly validate the immediate instance itself.
107 *
108 * If "items" is an array of schemas, validation succeeds if every instance
109 * element at a position greater than the size of "items" validates against
110 * "additionalItems".
111 *
112 * Otherwise, "additionalItems" MUST be ignored, as the "items" schema
113 * (possibly the default value of an empty schema) is applied to all elements.
114 *
115 * Omitting this keyword has the same behavior as an empty schema.
116 */
117 additionalItems?: JSONSchema | boolean
118 /**
119 * The value of "additionalProperties" MUST be a valid JSON Schema.
120 *
121 * This keyword determines how child instances validate for objects, and does
122 * not directly validate the immediate instance itself.
123 *
124 * Validation with "additionalProperties" applies only to the child values of
125 * instance names that do not match any names in "properties", and do not
126 * match any regular expression in "patternProperties".
127 *
128 * For all such properties, validation succeeds if the child instance
129 * validates against the "additionalProperties" schema.
130 *
131 * Omitting this keyword has the same behavior as an empty schema.
132 */
133 additionalProperties?: JSONSchema | boolean
134 /**
135 * This keyword's value MUST be a non-empty array. Each item of the array MUST
136 * be a valid JSON Schema.
137 *
138 * An instance validates successfully against this keyword if it validates
139 * successfully against all schemas defined by this keyword's value.
140 */
141 allOf?: (JSONSchema | boolean)[]
142 /**
143 * This keyword's value MUST be a non-empty array. Each item of the array MUST
144 * be a valid JSON Schema.
145 *
146 * An instance validates successfully against this keyword if it validates
147 * successfully against at least one schema defined by this keyword's value.
148 */
149 anyOf?: (JSONSchema | boolean)[]
150 /**
151 * The value of this keyword MAY be of any type, including null.
152 *
153 * An instance validates successfully against this keyword if its value is
154 * equal to the value of the keyword.
155 */
156 const?: any
157 /**
158 * The value of this keyword MUST be a valid JSON Schema.
159 *
160 * An array instance is valid against "contains" if at least one of its
161 * elements is valid against the given schema.
162 */
163 contains?: JSONSchema | boolean
164 /**
165 * If the instance value is a string, this property defines that the string
166 * SHOULD be interpreted as binary data and decoded using the encoding named
167 * by this property. [RFC 2045, Sec 6.1][RFC2045] lists the possible values for
168 * this property.
169 *
170 * The value of this property SHOULD be ignored if the instance described is
171 * not a string.
172 *
173 * [RFC2045]: https://tools.ietf.org/html/rfc2045#section-6.1
174 */
175 contentEncoding?: JSONSchemaContentEncodingName | JSONSchemaContentEncoding
176 /**
177 * The value of this property must be a media type, as defined by
178 * [RFC 2046][RFC2046]. This property defines the media type of instances
179 * which this schema defines.
180 *
181 * The value of this property SHOULD be ignored if the instance described is
182 * not a string.
183 *
184 * If the "contentEncoding" property is not present, but the instance value is
185 * a string, then the value of this property SHOULD specify a text document
186 * type, and the character set SHOULD be the character set into which the
187 * JSON string value was decoded (for which the default is Unicode).
188 *
189 * [RFC2046]: https://tools.ietf.org/html/rfc2046
190 */
191 contentMediaType?: string
192 /**
193 * There are no restrictions placed on the value of this keyword. When
194 * multiple occurrences of this keyword are applicable to a single
195 * sub-instance, implementations SHOULD remove duplicates.
196 *
197 * This keyword can be used to supply a default JSON value associated with a
198 * particular schema. It is RECOMMENDED that a default value be valid against
199 * the associated schema.
200 */
201 default?: any
202 /**
203 * The "definitions" keywords provides a standardized location for schema
204 * authors to inline re-usable JSON Schemas into a more general schema. The
205 * keyword does not directly affect the validation result.
206 *
207 * This keyword's value MUST be an object. Each member value of this object
208 * MUST be a valid JSON Schema.
209 */
210 definitions?: {
211 [key: string]: JSONSchema | boolean
212 }
213 /**
214 * This keyword specifies rules that are evaluated if the instance is an
215 * object and contains a certain property.
216 *
217 * This keyword's value MUST be an object. Each property specifies a
218 * dependency. Each dependency value MUST be an array or a valid JSON Schema.
219 *
220 * If the dependency value is a subschema, and the dependency key is a
221 * property in the instance, the entire instance must validate against the
222 * dependency value.
223 *
224 * If the dependency value is an array, each element in the array, if any,
225 * MUST be a string, and MUST be unique. If the dependency key is a property
226 * in the instance, each of the items in the dependency value must be a
227 * property that exists in the instance.
228 *
229 * Omitting this keyword has the same behavior as an empty object.
230 */
231 dependencies?:
232 | {
233 [key: string]: JSONSchema | boolean | string[]
234 }
235 | string[]
236 /**
237 * Can be used to decorate a user interface with explanation or information
238 * about the data produced.
239 */
240 description?: string
241 /**
242 * This keyword's value MUST be a valid JSON Schema.
243 *
244 * When "if" is present, and the instance fails to validate against its
245 * subschema, then validation succeeds against this keyword if the instance
246 * successfully validates against this keyword's subschema.
247 *
248 * This keyword has no effect when "if" is absent, or when the instance
249 * successfully validates against its subschema. Implementations MUST NOT
250 * evaluate the instance against this keyword, for either validation or
251 * annotation collection purposes, in such cases.
252 */
253 else?: JSONSchema | boolean
254 /**
255 * The value of this keyword MUST be an array. This array SHOULD have at least
256 * one element. Elements in the array SHOULD be unique.
257 *
258 * An instance validates successfully against this keyword if its value is
259 * equal to one of the elements in this keyword's array value.
260 *
261 * Elements in the array might be of any value, including null.
262 */
263 enum?: any[]
264 /**
265 * The value of this keyword MUST be an array. There are no restrictions
266 * placed on the values within the array. When multiple occurrences of this
267 * keyword are applicable to a single sub-instance, implementations MUST
268 * provide a flat array of all values rather than an array of arrays.
269 *
270 * This keyword can be used to provide sample JSON values associated with a
271 * particular schema, for the purpose of illustrating usage. It is RECOMMENDED
272 * that these values be valid against the associated schema.
273 *
274 * Implementations MAY use the value(s) of "default", if present, as an
275 * additional example. If "examples" is absent, "default" MAY still be used in
276 * this manner.
277 */
278 examples?: any[]
279 /**
280 * The value of "exclusiveMaximum" MUST be number, representing an exclusive
281 * upper limit for a numeric instance.
282 *
283 * If the instance is a number, then the instance is valid only if it has a
284 * value strictly less than (not equal to) "exclusiveMaximum".
285 */
286 exclusiveMaximum?: number
287 /**
288 * The value of "exclusiveMinimum" MUST be number, representing an exclusive
289 * lower limit for a numeric instance.
290 *
291 * If the instance is a number, then the instance is valid only if it has a
292 * value strictly greater than (not equal to) "exclusiveMinimum".
293 */
294 exclusiveMinimum?: number
295 /**
296 * The "format" keyword functions as both an [annotation][annotation] and as
297 * an [assertion][assertion]. While no special effort is required to implement
298 * it as an annotation conveying semantic meaning, implementing validation is
299 * non-trivial.
300 *
301 * Implementations MAY support the "format" keyword as a validation assertion.
302 * Should they choose to do so:
303 *
304 * - they SHOULD implement validation for attributes defined below;
305 * - they SHOULD offer an option to disable validation for this keyword.
306 *
307 * Implementations MAY add custom format attributes. Save for agreement
308 * between parties, schema authors SHALL NOT expect a peer implementation to
309 * support this keyword and/or custom format attributes.
310 *
311 * [annotation]: http://json-schema.org/latest/json-schema-validation.html#annotations
312 * [assertion]: http://json-schema.org/latest/json-schema-validation.html#assertions
313 */
314 format?:
315 | JSONSchemaFormat
316 | 'date'
317 | 'date-time'
318 | 'email'
319 | 'full-date'
320 | 'full-time'
321 | 'hostname'
322 | 'idn-email'
323 | 'idn-hostname'
324 | 'ipv4'
325 | 'ipv6'
326 | 'iri'
327 | 'iri-reference'
328 | 'json-pointer'
329 | 'json-pointer-uri-fragment'
330 | 'regex'
331 | 'relative-json-pointer'
332 | 'time'
333 | 'uri'
334 | 'uri-reference'
335 | 'uri-template'
336 | 'uuid'
337 /**
338 * This keyword's value MUST be a valid JSON Schema.
339 *
340 * This validation outcome of this keyword's subschema has no direct effect on
341 * the overall validation result. Rather, it controls which of the "then" or
342 * "else" keywords are evaluated.
343 *
344 * Instances that successfully validate against this keyword's subschema MUST
345 * also be valid against the subschema value of the "then" keyword, if
346 * present.
347 *
348 * Instances that fail to validate against this keyword's subschema MUST also
349 * be valid against the subschema value of the "else" keyword, if present.
350 *
351 * If [annotations][annotations] are being collected, they are collected from
352 * this keyword's subschema in the usual way, including when the keyword is
353 * present without either "then" or "else".
354 *
355 * [annotations]: http://json-schema.org/latest/json-schema-validation.html#annotations
356 */
357 if?: JSONSchema | boolean
358 /**
359 * The value of "items" MUST be either a valid JSON Schema or an array of
360 * valid JSON Schemas.
361 *
362 * This keyword determines how child instances validate for arrays, and does
363 * not directly validate the immediate instance itself.
364 *
365 * If "items" is a schema, validation succeeds if all elements in the array
366 * successfully validate against that schema.
367 *
368 * If "items" is an array of schemas, validation succeeds if each element of
369 * the instance validates against the schema at the same position, if any.
370 *
371 * Omitting this keyword has the same behavior as an empty schema.
372 */
373 items?: JSONSchema | boolean | (JSONSchema | boolean)[]
374 /**
375 * The value of "maximum" MUST be a number, representing an inclusive upper
376 * limit for a numeric instance.
377 *
378 * If the instance is a number, then this keyword validates only if the
379 * instance is less than or exactly equal to "maximum".
380 */
381 maximum?: number
382 /**
383 * The value of this keyword MUST be a non-negative integer.
384 *
385 * An array instance is valid against "maxItems" if its size is less than, or
386 * equal to, the value of this keyword.
387 */
388 maxItems?: number
389 /**
390 * The value of this keyword MUST be a non-negative integer.
391 *
392 * A string instance is valid against this keyword if its length is less than,
393 * or equal to, the value of this keyword.
394 *
395 * The length of a string instance is defined as the number of its characters
396 * as defined by [RFC 7159][RFC7159].
397 *
398 * [RFC7159]: http://json-schema.org/latest/json-schema-validation.html#RFC7159
399 */
400 maxLength?: number
401 /**
402 * The value of this keyword MUST be a non-negative integer.
403 *
404 * An object instance is valid against "maxProperties" if its number of
405 * properties is less than, or equal to, the value of this keyword.
406 */
407 maxProperties?: number
408 /**
409 * The value of "minimum" MUST be a number, representing an inclusive lower
410 * limit for a numeric instance.
411 *
412 * If the instance is a number, then this keyword validates only if the
413 * instance is greater than or exactly equal to "minimum".
414 */
415 minimum?: number
416 /**
417 * The value of this keyword MUST be a non-negative integer.
418 *
419 * A string instance is valid against this keyword if its length is greater
420 * than, or equal to, the value of this keyword.
421 *
422 * The length of a string instance is defined as the number of its characters
423 * as defined by [RFC 7159][RFC7159].
424 *
425 * Omitting this keyword has the same behavior as a value of 0.
426 *
427 * [RFC7159]: http://json-schema.org/latest/json-schema-validation.html#RFC7159
428 */
429 minLength?: number
430 /**
431 * The value of this keyword MUST be a non-negative integer.
432 *
433 * An array instance is valid against "minItems" if its size is greater than,
434 * or equal to, the value of this keyword.
435 *
436 * Omitting this keyword has the same behavior as a value of 0.
437 */
438 minItems?: number
439 /**
440 * The value of this keyword MUST be a non-negative integer.
441 *
442 * An object instance is valid against "minProperties" if its number of
443 * properties is greater than, or equal to, the value of this keyword.
444 *
445 * Omitting this keyword has the same behavior as a value of 0.
446 */
447 minProperties?: number
448 /**
449 * The value of "multipleOf" MUST be a number, strictly greater than 0.
450 *
451 * A numeric instance is valid only if division by this keyword's value
452 * results in an integer.
453 */
454 multipleOf?: number
455 /**
456 * This keyword's value MUST be a valid JSON Schema.
457 *
458 * An instance is valid against this keyword if it fails to validate
459 * successfully against the schema defined by this keyword.
460 */
461 not?: JSONSchema | boolean
462 /**
463 * This keyword's value MUST be a non-empty array. Each item of the array MUST
464 * be a valid JSON Schema.
465 *
466 * An instance validates successfully against this keyword if it validates
467 * successfully against exactly one schema defined by this keyword's value.
468 */
469 oneOf?: (JSONSchema | boolean)[]
470 /**
471 * The value of this keyword MUST be a string. This string SHOULD be a valid
472 * regular expression, according to the ECMA 262 regular expression dialect.
473 *
474 * A string instance is considered valid if the regular expression matches the
475 * instance successfully. Recall: regular expressions are not implicitly
476 * anchored.
477 */
478 pattern?: string
479 /**
480 * The value of "patternProperties" MUST be an object. Each property name of
481 * this object SHOULD be a valid regular expression, according to the ECMA 262
482 * regular expression dialect. Each property value of this object MUST be a
483 * valid JSON Schema.
484 *
485 * This keyword determines how child instances validate for objects, and does
486 * not directly validate the immediate instance itself. Validation of the
487 * primitive instance type against this keyword always succeeds.
488 *
489 * Validation succeeds if, for each instance name that matches any regular
490 * expressions that appear as a property name in this keyword's value, the
491 * child instance for that name successfully validates against each schema
492 * that corresponds to a matching regular expression.
493 *
494 * Omitting this keyword has the same behavior as an empty object.
495 */
496 patternProperties?: {
497 [key: string]: JSONSchema | boolean
498 }
499 /**
500 * The value of "properties" MUST be an object. Each value of this object MUST
501 * be a valid JSON Schema.
502 *
503 * This keyword determines how child instances validate for objects, and does
504 * not directly validate the immediate instance itself.
505 *
506 * Validation succeeds if, for each name that appears in both the instance and
507 * as a name within this keyword's value, the child instance for that name
508 * successfully validates against the corresponding schema.
509 *
510 * Omitting this keyword has the same behavior as an empty object.
511 */
512 properties?: {
513 [key: string]: JSONSchema | boolean
514 }
515 /**
516 * The value of "propertyNames" MUST be a valid JSON Schema.
517 *
518 * If the instance is an object, this keyword validates if every property name
519 * in the instance validates against the provided schema. Note the property
520 * name that the schema is testing will always be a string.
521 *
522 * Omitting this keyword has the same behavior as an empty schema.
523 */
524 propertyNames?: JSONSchema | boolean
525 /**
526 * The value of this keywords MUST be a boolean. When multiple occurrences of
527 * this keyword are applicable to a single sub-instance, the resulting value
528 * MUST be true if any occurrence specifies a true value, and MUST be false
529 * otherwise.
530 *
531 * If "readOnly" has a value of boolean true, it indicates that the value of
532 * the instance is managed exclusively by the owning authority, and attempts
533 * by an application to modify the value of this property are expected to be
534 * ignored or rejected by that owning authority.
535 *
536 * An instance document that is marked as "readOnly for the entire document
537 * MAY be ignored if sent to the owning authority, or MAY result in an error,
538 * at the authority's discretion.
539 *
540 * For example, "readOnly" would be used to mark a database-generated serial
541 * number as read-only.
542 *
543 * This keywords can be used to assist in user interface instance generation.
544 *
545 * @default false
546 */
547 readOnly?: boolean
548 /**
549 * The value of this keyword MUST be an array. Elements of this array, if any,
550 * MUST be strings, and MUST be unique.
551 *
552 * An object instance is valid against this keyword if every item in the array
553 * is the name of a property in the instance.
554 *
555 * Omitting this keyword has the same behavior as an empty array.
556 *
557 * @default []
558 */
559 required?: string[]
560 /**
561 * This keyword's value MUST be a valid JSON Schema.
562 *
563 * When "if" is present, and the instance successfully validates against its
564 * subschema, then validation succeeds against this keyword if the instance
565 * also successfully validates against this keyword's subschema.
566 *
567 * This keyword has no effect when "if" is absent, or when the instance fails
568 * to validate against its subschema. Implementations MUST NOT evaluate the
569 * instance against this keyword, for either validation or annotation
570 * collection purposes, in such cases.
571 */
572 then?: JSONSchema | boolean
573 /**
574 * Can be used to decorate a user interface with a short label about the data
575 * produced.
576 */
577 title?: string
578 /**
579 * The value of this keyword MUST be either a string or an array. If it is an
580 * array, elements of the array MUST be strings and MUST be unique.
581 *
582 * String values MUST be one of the six primitive types ("null", "boolean",
583 * "object", "array", "number", or "string"), or "integer" which matches any
584 * number with a zero fractional part.
585 *
586 * An instance validates if and only if the instance is in any of the sets
587 * listed for this keyword.
588 */
589 type?:
590 | JSONSchemaType
591 | JSONSchemaTypeName
592 | (JSONSchemaType | JSONSchemaTypeName)[]
593 /**
594 * The value of this keyword MUST be a boolean.
595 *
596 * If this keyword has boolean value false, the instance validates
597 * successfully. If it has boolean value true, the instance validates
598 * successfully if all of its elements are unique.
599 *
600 * Omitting this keyword has the same behavior as a value of false.
601 *
602 * @default false
603 */
604 uniqueItems?: boolean
605 /**
606 * The value of this keyword MUST be a boolean. When multiple occurrences of
607 * this keyword is applicable to a single sub-instance, the resulting value
608 * MUST be true if any occurrence specifies a true value, and MUST be false
609 * otherwise.
610 *
611 * If "writeOnly" has a value of boolean true, it indicates that the value is
612 * never present when the instance is retrieved from the owning authority. It
613 * can be present when sent to the owning authority to update or create the
614 * document (or the resource it represents), but it will not be included in
615 * any updated or newly created version of the instance.
616 *
617 * An instance document that is marked as "writeOnly" for the entire document
618 * MAY be returned as a blank document of some sort, or MAY produce an error
619 * upon retrieval, or have the retrieval request ignored, at the authority's
620 * discretion.
621 *
622 * For example, "writeOnly" would be used to mark a password input field.
623 *
624 * These keywords can be used to assist in user interface instance generation.
625 * In particular, an application MAY choose to use a widget that hides input
626 * values as they are typed for write-only fields.
627 *
628 * @default false
629 */
630 writeOnly?: boolean
631}
632/**
633 * String formats.
634 *
635 * @public
636 */
637export declare enum JSONSchemaFormat {
638 /**
639 * A string instance is valid against this attribute if it is a valid
640 * representation according to the "full-date" production in
641 * [RFC 3339][RFC3339].
642 *
643 * [RFC3339]: http://json-schema.org/latest/json-schema-validation.html#RFC3339
644 */
645 Date = 'date',
646 /**
647 * A string instance is valid against this attribute if it is a valid
648 * representation according to the "date-time" production in
649 * [RFC 3339][RFC3339].
650 *
651 * [RFC3339]: http://json-schema.org/latest/json-schema-validation.html#RFC3339
652 */
653 DateTime = 'date-time',
654 /**
655 * A string instance is valid against these attributes if it is a valid
656 * Internet email address as defined by [RFC 5322, section 3.4.1][RFC5322].
657 *
658 * [RFC5322]: http://json-schema.org/latest/json-schema-validation.html#RFC5322
659 */
660 Email = 'email',
661 /**
662 * As defined by [RFC 1034, section 3.1][RFC1034], including host names
663 * produced using the Punycode algorithm specified in
664 * [RFC 5891, section 4.4][RFC5891].
665 *
666 * [RFC1034]: http://json-schema.org/latest/json-schema-validation.html#RFC1034
667 * [RFC5891]: http://json-schema.org/latest/json-schema-validation.html#RFC5891
668 */
669 Hostname = 'hostname',
670 /**
671 * A string instance is valid against these attributes if it is a valid
672 * Internet email address as defined by [RFC 6531][RFC6531].
673 *
674 * [RFC6531]: http://json-schema.org/latest/json-schema-validation.html#RFC6531
675 */
676 IDNEmail = 'idn-email',
677 /**
678 * As defined by either [RFC 1034, section 3.1][RFC1034] as for hostname, or
679 * an internationalized hostname as defined by
680 * [RFC 5890, section 2.3.2.3][RFC5890].
681 *
682 * [RFC1034]: http://json-schema.org/latest/json-schema-validation.html#RFC1034
683 * [RFC5890]: http://json-schema.org/latest/json-schema-validation.html#RFC5890
684 */
685 IDNHostname = 'idn-hostname',
686 /**
687 * An IPv4 address according to the "dotted-quad" ABNF syntax as defined in
688 * [RFC 2673, section 3.2][RFC2673].
689 *
690 * [RFC2673]: http://json-schema.org/latest/json-schema-validation.html#RFC2673
691 */
692 IPv4 = 'ipv4',
693 /**
694 * An IPv6 address as defined in [RFC 4291, section 2.2][RFC4291].
695 *
696 * [RFC4291]: http://json-schema.org/latest/json-schema-validation.html#RFC4291
697 */
698 IPv6 = 'ipv6',
699 /**
700 * A string instance is valid against this attribute if it is a valid IRI,
701 * according to [RFC3987][RFC3987].
702 *
703 * [RFC3987]: http://json-schema.org/latest/json-schema-validation.html#RFC3987
704 */
705 IRI = 'iri',
706 /**
707 * A string instance is valid against this attribute if it is a valid IRI
708 * Reference (either an IRI or a relative-reference), according to
709 * [RFC3987][RFC3987].
710 *
711 * [RFC3987]: http://json-schema.org/latest/json-schema-validation.html#RFC3987
712 */
713 IRIReference = 'iri-reference',
714 /**
715 * A string instance is valid against this attribute if it is a valid JSON
716 * string representation of a JSON Pointer, according to
717 * [RFC 6901, section 5][RFC6901].
718 *
719 * [RFC6901]: http://json-schema.org/latest/json-schema-validation.html#RFC6901
720 */
721 JSONPointer = 'json-pointer',
722 /**
723 * A string instance is valid against this attribute if it is a valid JSON
724 * string representation of a JSON Pointer fragment, according to
725 * [RFC 6901, section 5][RFC6901].
726 *
727 * [RFC6901]: http://json-schema.org/latest/json-schema-validation.html#RFC6901
728 */
729 JSONPointerURIFragment = 'json-pointer-uri-fragment',
730 /**
731 * This attribute applies to string instances.
732 *
733 * A regular expression, which SHOULD be valid according to the
734 * [ECMA 262][ecma262] regular expression dialect.
735 *
736 * Implementations that validate formats MUST accept at least the subset of
737 * [ECMA 262][ecma262] defined in the [Regular Expressions][regexInterop]
738 * section of this specification, and SHOULD accept all valid
739 * [ECMA 262][ecma262] expressions.
740 *
741 * [ecma262]: http://json-schema.org/latest/json-schema-validation.html#ecma262
742 * [regexInterop]: http://json-schema.org/latest/json-schema-validation.html#regexInterop
743 */
744 RegEx = 'regex',
745 /**
746 * A string instance is valid against this attribute if it is a valid
747 * [Relative JSON Pointer][relative-json-pointer].
748 *
749 * [relative-json-pointer]: http://json-schema.org/latest/json-schema-validation.html#relative-json-pointer
750 */
751 RelativeJSONPointer = 'relative-json-pointer',
752 /**
753 * A string instance is valid against this attribute if it is a valid
754 * representation according to the "time" production in [RFC 3339][RFC3339].
755 *
756 * [RFC3339]: http://json-schema.org/latest/json-schema-validation.html#RFC3339
757 */
758 Time = 'time',
759 /**
760 * A string instance is valid against this attribute if it is a valid URI,
761 * according to [RFC3986][RFC3986].
762 *
763 * [RFC3986]: http://json-schema.org/latest/json-schema-validation.html#RFC3986
764 */
765 URI = 'uri',
766 /**
767 * A string instance is valid against this attribute if it is a valid URI
768 * Reference (either a URI or a relative-reference), according to
769 * [RFC3986][RFC3986].
770 *
771 * [RFC3986]: http://json-schema.org/latest/json-schema-validation.html#RFC3986
772 */
773 URIReference = 'uri-reference',
774 /**
775 * A string instance is valid against this attribute if it is a valid URI
776 * Template (of any level), according to [RFC6570][RFC6570].
777 *
778 * Note that URI Templates may be used for IRIs; there is no separate IRI
779 * Template specification.
780 *
781 * [RFC6570]: http://json-schema.org/latest/json-schema-validation.html#RFC6570
782 */
783 URITemplate = 'uri-template',
784 /**
785 * UUID
786 */
787 UUID = 'uuid'
788}
789/**
790 * JSON Schema type.
791 *
792 * @public
793 */
794export declare type JSONSchemaTypeName =
795 | 'array'
796 | 'boolean'
797 | 'integer'
798 | 'null'
799 | 'number'
800 | 'object'
801 | 'string'
802/**
803 * JSON Schema type.
804 *
805 * @public
806 */
807export declare enum JSONSchemaType {
808 /**
809 * Array
810 */
811 Array = 'array',
812 /**
813 * Boolean
814 */
815 Boolean = 'boolean',
816 /**
817 * Integer
818 */
819 Integer = 'integer',
820 /**
821 * Null
822 */
823 Null = 'null',
824 /**
825 * Number
826 */
827 Number = 'number',
828 /**
829 * Object
830 */
831 Object = 'object',
832 /**
833 * String
834 */
835 String = 'string'
836}
837/**
838 * Acceptable values for the "type" property.
839 *
840 * @public
841 */
842export declare type JSONSchemaTypeValue =
843 | JSONSchemaTypeName
844 | JSONSchemaType
845 | (JSONSchemaType | JSONSchemaTypeName)[]
846/**
847 * Content encoding name.
848 *
849 * @public
850 */
851export declare type JSONSchemaContentEncodingName =
852 | '7bit'
853 | '8bit'
854 | 'binary'
855 | 'quoted-printable'
856 | 'base64'
857 | 'ietf-token'
858 | 'x-token'
859/**
860 * Content encoding strategy.
861 *
862 * @public
863 * {@link https://tools.ietf.org/html/rfc2045#section-6.1}
864 * {@link https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705}
865 */
866export declare enum JSONSchemaContentEncoding {
867 /**
868 * Only US-ASCII characters, which use the lower 7 bits for each character.
869 *
870 * Each line must be less than 1,000 characters.
871 */
872 '7bit' = '7bit',
873 /**
874 * Allow extended ASCII characters which can use the 8th (highest) bit to
875 * indicate special characters not available in 7bit.
876 *
877 * Each line must be less than 1,000 characters.
878 */
879 '8bit' = '8bit',
880 /**
881 * Same character set as 8bit, with no line length restriction.
882 */
883 Binary = 'binary',
884 /**
885 * Lines are limited to 76 characters, and line breaks are represented using
886 * special characters that are escaped.
887 */
888 QuotedPrintable = 'quoted-printable',
889 /**
890 * Useful for data that is mostly non-text.
891 */
892 Base64 = 'base64',
893 /**
894 * An extension token defined by a standards-track RFC and registered with
895 * IANA.
896 */
897 IETFToken = 'ietf-token',
898 /**
899 * The two characters "X-" or "x-" followed, with no intervening white space,
900 * by any token.
901 */
902 XToken = 'x-token'
903}
904/**
905 * An array containing all the possible keys of a draft-07 JSONSchema.
906 *
907 * @public
908 */
909export declare const JSONSchemaKeys: (keyof JSONSchema)[]