@orpc/interop 0.0.0-next.0021fba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/compression/index.d.mts +2 -0
- package/dist/compression/index.d.ts +2 -0
- package/dist/compression/index.mjs +14526 -0
- package/dist/json-schema-typed/draft-07.d.mts +883 -0
- package/dist/json-schema-typed/draft-07.d.ts +883 -0
- package/dist/json-schema-typed/draft-07.mjs +100 -0
- package/dist/json-schema-typed/draft-2019-09.d.mts +1248 -0
- package/dist/json-schema-typed/draft-2019-09.d.ts +1248 -0
- package/dist/json-schema-typed/draft-2019-09.mjs +114 -0
- package/dist/json-schema-typed/draft-2020-12.d.mts +1 -0
- package/dist/json-schema-typed/draft-2020-12.d.ts +1 -0
- package/dist/json-schema-typed/draft-2020-12.mjs +1 -0
- package/dist/json-schema-typed/index.d.mts +1240 -0
- package/dist/json-schema-typed/index.d.ts +1240 -0
- package/dist/json-schema-typed/index.mjs +115 -0
- package/package.json +56 -0
@@ -0,0 +1,1248 @@
|
|
1
|
+
declare const draft: "2019-09";
|
2
|
+
declare const $schema: "https://json-schema.org/draft/2019-09/schema";
|
3
|
+
type MaybeReadonlyArray<T> = Array<T> | ReadonlyArray<T>;
|
4
|
+
type ValueOf<T> = T[keyof T];
|
5
|
+
/**
|
6
|
+
* JSON Schema [Draft 2019-09](https://json-schema.org/draft/2019-09/json-schema-validation.html)
|
7
|
+
*/
|
8
|
+
type JSONSchema<Value = any, SchemaType = Value extends boolean ? "boolean" : Value extends null ? "null" : Value extends number ? "number" | "integer" : Value extends string ? "string" : Value extends unknown[] ? "array" : Value extends Record<string | number, unknown> ? "object" : JSONSchema.TypeValue> = boolean | {
|
9
|
+
/**
|
10
|
+
* Using JSON Pointer fragments requires knowledge of the structure of the
|
11
|
+
* schema. When writing schema documents with the intention to provide
|
12
|
+
* re-usable schemas, it may be preferable to use a plain name fragment
|
13
|
+
* that is not tied to any particular structural location. This allows a
|
14
|
+
* subschema to be relocated without requiring JSON Pointer references to
|
15
|
+
* be updated.
|
16
|
+
*
|
17
|
+
* The `$anchor` keyword is used to specify such a fragment. It is an
|
18
|
+
* identifier keyword that can only be used to create plain name fragments.
|
19
|
+
*
|
20
|
+
* If present, the value of this keyword MUST be a string, which MUST start
|
21
|
+
* with a letter `[A-Za-z]`, followed by any number of letters, digits
|
22
|
+
* `[0-9]`, hyphens `-`, underscores `_`, colons `:`,
|
23
|
+
* or periods `.`.
|
24
|
+
*
|
25
|
+
* Note that the anchor string does not include the `#` character,
|
26
|
+
* as it is not a URI-reference. An `{"$anchor": "foo"}` becomes the
|
27
|
+
* fragment `#foo` when used in a URI.
|
28
|
+
*
|
29
|
+
* The base URI to which the resulting fragment is appended is determined
|
30
|
+
* by the `$id` keyword as explained in the previous section.
|
31
|
+
* Two `$anchor` keywords in the same schema document MAY have the same
|
32
|
+
* value if they apply to different base URIs, as the resulting full URIs
|
33
|
+
* will be distinct. However, the effect of two `$anchor` keywords
|
34
|
+
* with the same value and the same base URI is undefined. Implementations
|
35
|
+
* MAY raise an error if such usage is detected.
|
36
|
+
*/
|
37
|
+
$anchor?: string;
|
38
|
+
/**
|
39
|
+
* This keyword reserves a location for comments from schema authors
|
40
|
+
* to readers or maintainers of the schema.
|
41
|
+
*
|
42
|
+
* The value of this keyword MUST be a string. Implementations MUST NOT
|
43
|
+
* present this string to end users. Tools for editing schemas SHOULD
|
44
|
+
* support displaying and editing this keyword. The value of this keyword
|
45
|
+
* MAY be used in debug or error output which is intended for developers
|
46
|
+
* making use of schemas.
|
47
|
+
*
|
48
|
+
* Schema vocabularies SHOULD allow `$comment` within any object
|
49
|
+
* containing vocabulary keywords. Implementations MAY assume `$comment`
|
50
|
+
* is allowed unless the vocabulary specifically forbids it. Vocabularies
|
51
|
+
* MUST NOT specify any effect of `$comment` beyond what is described in
|
52
|
+
* this specification.
|
53
|
+
*
|
54
|
+
* Tools that translate other media types or programming languages
|
55
|
+
* to and from `application/schema+json` MAY choose to convert that media
|
56
|
+
* type or programming language's native comments to or from `$comment`
|
57
|
+
* values. The behavior of such translation when both native comments and
|
58
|
+
* `$comment` properties are present is implementation-dependent.
|
59
|
+
*
|
60
|
+
* Implementations SHOULD treat `$comment` identically to an unknown
|
61
|
+
* extension keyword. They MAY strip `$comment` values at any point
|
62
|
+
* during processing. In particular, this allows for shortening schemas
|
63
|
+
* when the size of deployed schemas is a concern.
|
64
|
+
*
|
65
|
+
* Implementations MUST NOT take any other action based on the presence,
|
66
|
+
* absence, or contents of `$comment` properties. In particular, the
|
67
|
+
* value of `$comment` MUST NOT be collected as an annotation result.
|
68
|
+
*/
|
69
|
+
$comment?: string;
|
70
|
+
/**
|
71
|
+
* The `$defs` keywords provides a standardized location for schema
|
72
|
+
* authors to inline re-usable JSON Schemas into a more general schema. The
|
73
|
+
* keyword does not directly affect the validation result.
|
74
|
+
*
|
75
|
+
* This keyword's value MUST be an object. Each member value of this object
|
76
|
+
* MUST be a valid JSON Schema.
|
77
|
+
*/
|
78
|
+
$defs?: Record<string, JSONSchema>;
|
79
|
+
/**
|
80
|
+
* The `$id` keyword identifies a schema resource with its
|
81
|
+
* [canonical][[RFC6596]] URI.
|
82
|
+
*
|
83
|
+
* Note that this URI is an identifier and not necessarily a network
|
84
|
+
* locator. In the case of a network-addressable URL, a schema need not be
|
85
|
+
* downloadable from its canonical URI.
|
86
|
+
*
|
87
|
+
* If present, the value for this keyword MUST be a string, and MUST
|
88
|
+
* represent a valid [URI-reference][RFC3986]. This URI-reference SHOULD
|
89
|
+
* be normalized, and MUST resolve to an [absolute-URI][RFC3986] (without a
|
90
|
+
* fragment). Therefore, `$id` MUST NOT contain a non-empty fragment,
|
91
|
+
* and SHOULD NOT contain an empty fragment.
|
92
|
+
*
|
93
|
+
* Since an empty fragment in the context of the
|
94
|
+
* `application/schema+json` media type refers to the same resource as
|
95
|
+
* the base URI without a fragment, an implementation MAY normalize a URI
|
96
|
+
* ending with an empty fragment by removing the fragment. However, schema
|
97
|
+
* authors SHOULD NOT rely on this behavior across implementations.
|
98
|
+
*
|
99
|
+
* This URI also serves as the base URI for relative URI-references in
|
100
|
+
* keywords within the schema resource, in accordance with
|
101
|
+
* [RFC 3986][RFC3986] section 5.1.1 regarding base URIs embedded in
|
102
|
+
* content.
|
103
|
+
*
|
104
|
+
* The presence of `$id` in a subschema indicates that the subschema
|
105
|
+
* constitutes a distinct schema resource within a single schema document.
|
106
|
+
* Furthermore, in accordance with [RFC 3986][RFC3986] section 5.1.2
|
107
|
+
* regarding encapsulating entities, if an `$id` in a subschema is a
|
108
|
+
* relative URI-reference, the base URI for resolving that reference is the
|
109
|
+
* URI of the parent schema resource.
|
110
|
+
*
|
111
|
+
* If no parent schema object explicitly identifies itself as a resource
|
112
|
+
* with `$id`, the base URI is that of the entire document.
|
113
|
+
*
|
114
|
+
* The root schema of a JSON Schema document SHOULD contain an `$id`
|
115
|
+
* keyword with an [absolute-URI][RFC3986] (containing a scheme, but no
|
116
|
+
* fragment).
|
117
|
+
*
|
118
|
+
* [RFC6596]: https://datatracker.ietf.org/doc/html/rfc6596
|
119
|
+
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
|
120
|
+
*
|
121
|
+
* @format "uri-reference"
|
122
|
+
*/
|
123
|
+
$id?: string;
|
124
|
+
/**
|
125
|
+
* The value of the `$recursiveAnchor` property MUST be a boolean.
|
126
|
+
*
|
127
|
+
* `$recursiveAnchor` is used to dynamically identify a base URI at
|
128
|
+
* runtime for `$recursiveRef` by marking where such a calculation can
|
129
|
+
* start, and where it stops. This keyword MUST NOT affect the base URI of
|
130
|
+
* other keywords, unless they are explicitly defined to rely on it.
|
131
|
+
*
|
132
|
+
* If set to `true`, then when the containing schema object is used as a
|
133
|
+
* target of `$recursiveRef`, a new base URI is determined by examining
|
134
|
+
* the [dynamic scope][scopes] for the outermost schema that also contains
|
135
|
+
* `$recursiveAnchor` with a value of `true`. The base URI of that
|
136
|
+
* schema is then used as the dynamic base URI.
|
137
|
+
*
|
138
|
+
* - If no such schema exists, then the base URI is unchanged.
|
139
|
+
* - If this keyword is set to `false`, the base URI is unchanged.
|
140
|
+
*
|
141
|
+
* Omitting this keyword has the same behavior as a value of `false`.
|
142
|
+
*
|
143
|
+
* [scopes]: https://json-schema.org/draft/2019-09/json-schema-core.html#scopes
|
144
|
+
*/
|
145
|
+
$recursiveAnchor?: boolean;
|
146
|
+
/**
|
147
|
+
* The value of the `$recursiveRef` property MUST be a string which is
|
148
|
+
* a URI-reference. It is a by-reference applicator that uses a
|
149
|
+
* dynamically calculated base URI to resolve its value.
|
150
|
+
*
|
151
|
+
* The behavior of this keyword is defined only for the value `"#"`.
|
152
|
+
* Implementations MAY choose to consider other values to be errors.
|
153
|
+
*
|
154
|
+
* The value of `$recursiveRef` is initially resolved against the
|
155
|
+
* current base URI, in the same manner as for `$ref`.
|
156
|
+
*
|
157
|
+
* The schema identified by the resulting URI is examined for the
|
158
|
+
* presence of `$recursiveAnchor`, and a new base URI is calculated.
|
159
|
+
*
|
160
|
+
* Finally, the value of `$recursiveRef` is resolved against the new base
|
161
|
+
* URI determined according to `$recursiveAnchor` producing the final
|
162
|
+
* resolved reference URI.
|
163
|
+
*
|
164
|
+
* Note that in the absence of `$recursiveAnchor` (and in some cases
|
165
|
+
* when it is present), `$recursiveRef`'s behavior is identical to
|
166
|
+
* that of `$ref`.
|
167
|
+
*
|
168
|
+
* As with `$ref`, the results of this keyword are the results of the
|
169
|
+
* referenced schema.
|
170
|
+
*
|
171
|
+
* @format "uri-reference"
|
172
|
+
*/
|
173
|
+
$recursiveRef?: string;
|
174
|
+
/**
|
175
|
+
* The `$ref` keyword is an applicator that is used to reference a
|
176
|
+
* statically identified schema. Its results are the results of the
|
177
|
+
* referenced schema. Other keywords can appear alongside of `$ref` in
|
178
|
+
* the same schema object.
|
179
|
+
*
|
180
|
+
* The value of the `$ref` property MUST be a string which is a
|
181
|
+
* URI-Reference. Resolved against the current URI base, it produces the
|
182
|
+
* URI of the schema to apply.
|
183
|
+
*
|
184
|
+
* @format "uri-reference"
|
185
|
+
*/
|
186
|
+
$ref?: string;
|
187
|
+
/**
|
188
|
+
* The `$schema` keyword is both used as a JSON Schema version identifier
|
189
|
+
* and the location of a resource which is itself a JSON Schema, which
|
190
|
+
* describes any schema written for this particular version.
|
191
|
+
*
|
192
|
+
* The value of this keyword MUST be a [URI][RFC3986] (containing a scheme)
|
193
|
+
* and this URI MUST be normalized. The current schema MUST be valid
|
194
|
+
* against the meta-schema identified by this URI.
|
195
|
+
*
|
196
|
+
* If this URI identifies a retrievable resource, that resource SHOULD be
|
197
|
+
* of media type `application/schema+json`.
|
198
|
+
*
|
199
|
+
* The `$schema` keyword SHOULD be used in a resource root schema.
|
200
|
+
* It MUST NOT appear in resource subschemas. If absent from the root
|
201
|
+
* schema, the resulting behavior is implementation-defined.
|
202
|
+
*
|
203
|
+
* If multiple schema resources are present in a single document, then all
|
204
|
+
* schema resources SHOULD Have the same value for `$schema`. The result
|
205
|
+
* of differing values for "$schema" within the same schema document is
|
206
|
+
* implementation-defined.
|
207
|
+
*
|
208
|
+
* Values for this property are defined elsewhere in this and other
|
209
|
+
* documents, and by other parties.
|
210
|
+
*
|
211
|
+
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
|
212
|
+
*
|
213
|
+
* @format "uri"
|
214
|
+
*/
|
215
|
+
$schema?: string;
|
216
|
+
/**
|
217
|
+
* The `$vocabulary` keyword is used in meta-schemas to identify the
|
218
|
+
* vocabularies available for use in schemas described by that meta-schema.
|
219
|
+
* It is also used to indicate whether each vocabulary is required or
|
220
|
+
* optional, in the sense that an implementation MUST understand the
|
221
|
+
* required vocabularies in order to successfully process the schema.
|
222
|
+
*
|
223
|
+
* The value of this keyword MUST be an object. The property names in the
|
224
|
+
* object MUST be URIs (containing a scheme) and this URI MUST be
|
225
|
+
* normalized. Each URI that appears as a property name identifies a
|
226
|
+
* specific set of keywords and their semantics.
|
227
|
+
*
|
228
|
+
* The URI MAY be a URL, but the nature of the retrievable resource is
|
229
|
+
* currently undefined, and reserved for future use. Vocabulary authors
|
230
|
+
* MAY use the URL of the vocabulary specification, in a human-readable
|
231
|
+
* media type such as `text/html` or `text/plain`, as the vocabulary
|
232
|
+
* URI.
|
233
|
+
*
|
234
|
+
* The values of the object properties MUST be booleans.
|
235
|
+
* If the value is `true`, then implementations that do not recognize
|
236
|
+
* the vocabulary MUST refuse to process any schemas that declare
|
237
|
+
* this meta-schema with "$schema". If the value is `false`,
|
238
|
+
* implementations that do not recognize the vocabulary SHOULD proceed with
|
239
|
+
* processing such schemas.
|
240
|
+
*
|
241
|
+
* Unrecognized keywords SHOULD be ignored. This remains the case for
|
242
|
+
* keywords defined by unrecognized vocabularies. It is not currently
|
243
|
+
* possible to distinguish between unrecognized keywords that are defined
|
244
|
+
* in vocabularies from those that are not part of any vocabulary.
|
245
|
+
*
|
246
|
+
* The `$vocabulary` keyword SHOULD be used in the root schema of any
|
247
|
+
* schema document intended for use as a meta-schema. It MUST NOT appear
|
248
|
+
* in subschemas.
|
249
|
+
*
|
250
|
+
* The `$vocabulary` keyword MUST be ignored in schema documents that are
|
251
|
+
* not being processed as a meta-schema.
|
252
|
+
*/
|
253
|
+
$vocabulary?: Record<string, string>;
|
254
|
+
/**
|
255
|
+
* The value of `additionalItems` MUST be a valid JSON Schema.
|
256
|
+
*
|
257
|
+
* The behavior of this keyword depends on the presence and annotation
|
258
|
+
* result of `items` within the same schema object.
|
259
|
+
* If `items` is present, and its annotation result is a number,
|
260
|
+
* validation succeeds if every instance element at an index greater than
|
261
|
+
* that number validates against `additionalItems`.
|
262
|
+
*
|
263
|
+
* Otherwise, if `items` is absent or its annotation result is the
|
264
|
+
* boolean `true`, `additionalItems` MUST be ignored.
|
265
|
+
*
|
266
|
+
* If the `additionalItems` subschema is applied to any positions within
|
267
|
+
* the instance array, it produces an annotation result of boolean
|
268
|
+
* `true`, analogous to the single schema behavior of `items`. If any
|
269
|
+
* `additionalItems` keyword from any subschema applied to the same
|
270
|
+
* instance location produces an annotation value of `true`, then the
|
271
|
+
* combined result from these keywords is also `true`.
|
272
|
+
*
|
273
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
274
|
+
* schema.
|
275
|
+
*
|
276
|
+
* Implementations MAY choose to implement or optimize this keyword in
|
277
|
+
* another way that produces the same effect, such as by directly
|
278
|
+
* checking for the presence and size of an `items` array.
|
279
|
+
*/
|
280
|
+
additionalItems?: JSONSchema;
|
281
|
+
/**
|
282
|
+
* The value of `additionalProperties` MUST be a valid JSON Schema.
|
283
|
+
*
|
284
|
+
* The behavior of this keyword depends on the presence and annotation
|
285
|
+
* results of `properties` and `patternProperties` within the same
|
286
|
+
* schema object. Validation with `additionalProperties` applies only to
|
287
|
+
* the child values of instance names that do not appear in the annotation
|
288
|
+
* results of either `properties` or `patternProperties`.
|
289
|
+
*
|
290
|
+
* For all such properties, validation succeeds if the child instance
|
291
|
+
* validates against the `additionalProperties` schema.
|
292
|
+
*
|
293
|
+
* The annotation result of this keyword is the set of instance property
|
294
|
+
* names validated by this keyword's subschema. Annotation results for
|
295
|
+
* `additionalProperties` keywords from multiple schemas applied to the
|
296
|
+
* same instance location are combined by taking the union of the sets.
|
297
|
+
*
|
298
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
299
|
+
* schema.
|
300
|
+
*
|
301
|
+
* Implementations MAY choose to implement or optimize this keyword in
|
302
|
+
* another way that produces the same effect, such as by directly checking
|
303
|
+
* the names in `properties` and the patterns in `patternProperties`
|
304
|
+
* against the instance property set.
|
305
|
+
*/
|
306
|
+
additionalProperties?: JSONSchema;
|
307
|
+
/**
|
308
|
+
* This keyword's value MUST be a non-empty array. Each item of the array
|
309
|
+
* MUST be a valid JSON Schema.
|
310
|
+
*
|
311
|
+
* An instance validates successfully against this keyword if it validates
|
312
|
+
* successfully against all schemas defined by this keyword's value.
|
313
|
+
*/
|
314
|
+
allOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;
|
315
|
+
/**
|
316
|
+
* This keyword's value MUST be a non-empty array. Each item of the array
|
317
|
+
* MUST be a valid JSON Schema.
|
318
|
+
*
|
319
|
+
* An instance validates successfully against this keyword if it validates
|
320
|
+
* successfully against at least one schema defined by this keyword's
|
321
|
+
* value.
|
322
|
+
*/
|
323
|
+
anyOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;
|
324
|
+
/**
|
325
|
+
* An instance validates successfully against this keyword if its value is
|
326
|
+
* equal to the value of the keyword.
|
327
|
+
*
|
328
|
+
* Use of this keyword is functionally equivalent to the `enum` keyword
|
329
|
+
* with a single value.
|
330
|
+
*/
|
331
|
+
const?: Value;
|
332
|
+
/**
|
333
|
+
* An array instance is valid against `contains` if at least one of
|
334
|
+
* its elements is valid against the given schema. Note that when
|
335
|
+
* collecting annotations, the subschema MUST be applied to every
|
336
|
+
* array element even after the first match has been found. This
|
337
|
+
* is to ensure that all possible annotations are collected.
|
338
|
+
*/
|
339
|
+
contains?: JSONSchema<Value, SchemaType>;
|
340
|
+
/**
|
341
|
+
* If the instance value is a string, this property defines that the
|
342
|
+
* string SHOULD be interpreted as binary data and decoded using the
|
343
|
+
* encoding named by this property. [RFC 2045, Sec 6.1][RFC2045] lists the
|
344
|
+
* possible values for this property.
|
345
|
+
*
|
346
|
+
* The value of this property SHOULD be ignored if the instance described
|
347
|
+
* is not a string.
|
348
|
+
*
|
349
|
+
* If this keyword is absent, but `contentMediaType` is present, this
|
350
|
+
* indicates that the media type could be encoded into `UTF-8` like any
|
351
|
+
* other JSON string value, and does not require additional decoding.
|
352
|
+
*
|
353
|
+
* The value of this property MUST be a string.
|
354
|
+
*
|
355
|
+
* [RFC2045]: https://datatracker.ietf.org/doc/html/rfc2045#section-6.1
|
356
|
+
*/
|
357
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
358
|
+
/**
|
359
|
+
* If the instance is a string, this property indicates the media type
|
360
|
+
* of the contents of the string. If `contentEncoding` is present,
|
361
|
+
* this property describes the decoded string.
|
362
|
+
*
|
363
|
+
* The value of this property must be a media type, as defined by
|
364
|
+
* [RFC 2046][RFC2046]. This property defines the media type of instances
|
365
|
+
* which this schema defines.
|
366
|
+
*
|
367
|
+
* The value of this property SHOULD be ignored if the instance described
|
368
|
+
* is not a string.
|
369
|
+
*
|
370
|
+
* If the `contentEncoding` property is not present, but the instance
|
371
|
+
* value is a string, then the value of this property SHOULD specify a text
|
372
|
+
* document type, and the character set SHOULD be the character set into
|
373
|
+
* which the JSON string value was decoded (for which the default is
|
374
|
+
* Unicode).
|
375
|
+
*
|
376
|
+
* [RFC2046]: https://datatracker.ietf.org/doc/html/rfc2046
|
377
|
+
*/
|
378
|
+
contentMediaType?: string;
|
379
|
+
/**
|
380
|
+
* If the instance is a string, and if `contentMediaType` is present,
|
381
|
+
* this property contains a schema which describes the structure of the
|
382
|
+
* string.
|
383
|
+
*
|
384
|
+
* This keyword MAY be used with any media type that can be mapped into
|
385
|
+
* JSON Schema's data model.
|
386
|
+
*
|
387
|
+
* The value of this property SHOULD be ignored if `contentMediaType` is
|
388
|
+
* not present.
|
389
|
+
*/
|
390
|
+
contentSchema?: JSONSchema<Value, SchemaType>;
|
391
|
+
/**
|
392
|
+
* This keyword can be used to supply a default JSON value associated with
|
393
|
+
* a particular schema. It is RECOMMENDED that a `default` value be valid
|
394
|
+
* against the associated schema.
|
395
|
+
*/
|
396
|
+
default?: Value;
|
397
|
+
/**
|
398
|
+
* @deprecated `definitions` has been renamed to `$defs`.
|
399
|
+
*/
|
400
|
+
definitions?: Record<string, JSONSchema>;
|
401
|
+
/**
|
402
|
+
* @deprecated `dependencies` has been split into two keywords:
|
403
|
+
* `dependentSchemas` and `dependentRequired`.
|
404
|
+
*/
|
405
|
+
dependencies?: Record<string, MaybeReadonlyArray<string> | JSONSchema>;
|
406
|
+
/**
|
407
|
+
* The value of this keyword MUST be an object. Properties in
|
408
|
+
* this object, if any, MUST be arrays. Elements in each array,
|
409
|
+
* if any, MUST be strings, and MUST be unique.
|
410
|
+
*
|
411
|
+
* This keyword specifies properties that are required if a specific
|
412
|
+
* other property is present. Their requirement is dependent on the
|
413
|
+
* presence of the other property.
|
414
|
+
*
|
415
|
+
* Validation succeeds if, for each name that appears in both
|
416
|
+
* the instance and as a name within this keyword's value, every
|
417
|
+
* item in the corresponding array is also the name of a property
|
418
|
+
* in the instance.
|
419
|
+
*
|
420
|
+
* Omitting this keyword has the same behavior as an empty object.
|
421
|
+
*/
|
422
|
+
dependentRequired?: Record<string, MaybeReadonlyArray<string>>;
|
423
|
+
/**
|
424
|
+
* This keyword specifies subschemas that are evaluated if the instance is
|
425
|
+
* an object and contains a certain property.
|
426
|
+
*
|
427
|
+
* This keyword's value MUST be an object. Each value in the object MUST be
|
428
|
+
* a valid JSON Schema.
|
429
|
+
*
|
430
|
+
* If the object key is a property in the instance, the entire instance
|
431
|
+
* must validate against the subschema. Its use is dependent on the
|
432
|
+
* presence of the property.
|
433
|
+
*
|
434
|
+
* Omitting this keyword has the same behavior as an empty object.
|
435
|
+
*/
|
436
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
437
|
+
/**
|
438
|
+
* The value of this keyword MUST be a boolean. When multiple occurrences
|
439
|
+
* of this keyword are applicable to a single sub-instance, applications
|
440
|
+
* SHOULD consider the instance location to be deprecated if any occurrence
|
441
|
+
* specifies a `true` value.
|
442
|
+
*
|
443
|
+
* If `deprecated` has a value of boolean `true`, it indicates that
|
444
|
+
* applications SHOULD refrain from usage of the declared property. It MAY
|
445
|
+
* mean the property is going to be removed in the future.
|
446
|
+
*
|
447
|
+
* A root schema containing `deprecated` with a value of `true`
|
448
|
+
* indicates that the entire resource being described MAY be removed in the
|
449
|
+
* future.
|
450
|
+
*
|
451
|
+
* When the `deprecated` keyword is applied to an item in an array by
|
452
|
+
* means of `items`, if `items` is a single schema, the deprecation
|
453
|
+
* relates to the whole array, while if `items` is an array of schemas,
|
454
|
+
* the deprecation relates to the corresponding item according to the
|
455
|
+
* subschemas position.
|
456
|
+
*
|
457
|
+
* Omitting this keyword has the same behavior as a value of `false`.
|
458
|
+
*/
|
459
|
+
deprecated?: boolean;
|
460
|
+
/**
|
461
|
+
* Can be used to decorate a user interface with explanation or information
|
462
|
+
* about the data produced.
|
463
|
+
*/
|
464
|
+
description?: string;
|
465
|
+
/**
|
466
|
+
* This keyword's value MUST be a valid JSON Schema.
|
467
|
+
*
|
468
|
+
* When `if` is present, and the instance fails to validate against its
|
469
|
+
* subschema, then validation succeeds against this keyword if the instance
|
470
|
+
* successfully validates against this keyword's subschema.
|
471
|
+
*
|
472
|
+
* This keyword has no effect when `if` is absent, or when the instance
|
473
|
+
* successfully validates against its subschema. Implementations MUST NOT
|
474
|
+
* evaluate the instance against this keyword, for either validation or
|
475
|
+
* annotation collection purposes, in such cases.
|
476
|
+
*/
|
477
|
+
else?: JSONSchema<Value, SchemaType>;
|
478
|
+
/**
|
479
|
+
* The value of this keyword MUST be an array. This array SHOULD have at
|
480
|
+
* least one element. Elements in the array SHOULD be unique.
|
481
|
+
*
|
482
|
+
* An instance validates successfully against this keyword if its value is
|
483
|
+
* equal to one of the elements in this keyword's array value.
|
484
|
+
*
|
485
|
+
* Elements in the array might be of any type, including `null`.
|
486
|
+
*/
|
487
|
+
enum?: MaybeReadonlyArray<Value>;
|
488
|
+
/**
|
489
|
+
* The value of this keyword MUST be an array. When multiple occurrences of
|
490
|
+
* this keyword are applicable to a single sub-instance, implementations
|
491
|
+
* MUST provide a flat array of all values rather than an array of arrays.
|
492
|
+
*
|
493
|
+
* This keyword can be used to provide sample JSON values associated with a
|
494
|
+
* particular schema, for the purpose of illustrating usage. It is
|
495
|
+
* RECOMMENDED that these values be valid against the associated schema.
|
496
|
+
*
|
497
|
+
* Implementations MAY use the value(s) of `default`, if present, as an
|
498
|
+
* additional example. If `examples` is absent, `default` MAY still be
|
499
|
+
* used in this manner.
|
500
|
+
*/
|
501
|
+
examples?: MaybeReadonlyArray<Value>;
|
502
|
+
/**
|
503
|
+
* The value of `exclusiveMaximum` MUST be a number, representing an
|
504
|
+
* exclusive upper limit for a numeric instance.
|
505
|
+
*
|
506
|
+
* If the instance is a number, then the instance is valid only if it has a
|
507
|
+
* value strictly less than (not equal to) `exclusiveMaximum`.
|
508
|
+
*/
|
509
|
+
exclusiveMaximum?: number;
|
510
|
+
/**
|
511
|
+
* The value of `exclusiveMinimum` MUST be a number, representing an
|
512
|
+
* exclusive lower limit for a numeric instance.
|
513
|
+
*
|
514
|
+
* If the instance is a number, then the instance is valid only if it has a
|
515
|
+
* value strictly greater than (not equal to) `exclusiveMinimum`.
|
516
|
+
*/
|
517
|
+
exclusiveMinimum?: number;
|
518
|
+
/**
|
519
|
+
* Implementations MAY treat `format` as an assertion in addition to an
|
520
|
+
* annotation, and attempt to validate the value's conformance to the
|
521
|
+
* specified semantics.
|
522
|
+
*
|
523
|
+
* The value of this keyword is called a format attribute. It MUST be a
|
524
|
+
* string. A format attribute can generally only validate a given set
|
525
|
+
* of instance types. If the type of the instance to validate is not in
|
526
|
+
* this set, validation for this format attribute and instance SHOULD
|
527
|
+
* succeed. Format attributes are most often applied to strings, but can
|
528
|
+
* be specified to apply to any type.
|
529
|
+
*
|
530
|
+
* Implementations MAY support custom format attributes. Save for agreement
|
531
|
+
* between parties, schema authors SHALL NOT expect a peer implementation
|
532
|
+
* to support such custom format attributes. An implementation MUST NOT
|
533
|
+
* fail validation or cease processing due to an unknown format attribute.
|
534
|
+
* When treating `format` as an annotation, implementations SHOULD
|
535
|
+
* collect both known and unknown format attribute values.
|
536
|
+
*/
|
537
|
+
format?: string;
|
538
|
+
/**
|
539
|
+
* This keyword's value MUST be a valid JSON Schema.
|
540
|
+
*
|
541
|
+
* This validation outcome of this keyword's subschema has no direct effect
|
542
|
+
* on the overall validation result. Rather, it controls which of the
|
543
|
+
* `then` or `else` keywords are evaluated.
|
544
|
+
*
|
545
|
+
* Instances that successfully validate against this keyword's subschema
|
546
|
+
* MUST also be valid against the subschema value of the `then` keyword,
|
547
|
+
* if present.
|
548
|
+
*
|
549
|
+
* Instances that fail to validate against this keyword's subschema MUST
|
550
|
+
* also be valid against the subschema value of the `else` keyword, if
|
551
|
+
* present.
|
552
|
+
*
|
553
|
+
* If annotations are being collected, they are collected
|
554
|
+
* from this keyword's subschema in the usual way, including when the
|
555
|
+
* keyword is present without either `then` or `else`.
|
556
|
+
*/
|
557
|
+
if?: JSONSchema<Value, SchemaType>;
|
558
|
+
/**
|
559
|
+
* The value of `items` MUST be either a valid JSON Schema or an array of
|
560
|
+
* valid JSON Schemas.
|
561
|
+
*
|
562
|
+
* If `items` is a schema, validation succeeds if all elements in the
|
563
|
+
* array successfully validate against that schema.
|
564
|
+
*
|
565
|
+
* If `items` is an array of schemas, validation succeeds if each element
|
566
|
+
* of the instance validates against the schema at the same position, if
|
567
|
+
* any.
|
568
|
+
*
|
569
|
+
* This keyword produces an annotation value which is the largest index to
|
570
|
+
* which this keyword applied a subschema. The value MAY be a boolean
|
571
|
+
* `true` if a subschema was applied to every index of the instance, such
|
572
|
+
* as when `items` is a schema.
|
573
|
+
*
|
574
|
+
* Annotation results for `items` keywords from multiple schemas applied
|
575
|
+
* to the same instance location are combined by setting the combined
|
576
|
+
* result to `true` if any of the values are `true`, and otherwise
|
577
|
+
* retaining the largest numerical value.
|
578
|
+
*
|
579
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
580
|
+
* schema.
|
581
|
+
*/
|
582
|
+
items?: MaybeReadonlyArray<JSONSchema> | JSONSchema;
|
583
|
+
/**
|
584
|
+
* The value of this keyword MUST be a non-negative integer.
|
585
|
+
*
|
586
|
+
* An array instance is valid against `maxContains` if the number of
|
587
|
+
* elements that are valid against the schema for
|
588
|
+
* `contains` is less than, or equal to, the value of this keyword.
|
589
|
+
*
|
590
|
+
* If `contains` is not present within the same schema object, then this
|
591
|
+
* keyword has no effect.
|
592
|
+
*/
|
593
|
+
maxContains?: number;
|
594
|
+
/**
|
595
|
+
* The value of `maximum` MUST be a number, representing an inclusive
|
596
|
+
* upper limit for a numeric instance.
|
597
|
+
*
|
598
|
+
* If the instance is a number, then this keyword validates only if the
|
599
|
+
* instance is less than or exactly equal to `maximum`.
|
600
|
+
*/
|
601
|
+
maximum?: number;
|
602
|
+
/**
|
603
|
+
* The value of this keyword MUST be a non-negative integer.
|
604
|
+
*
|
605
|
+
* An array instance is valid against `maxItems` if its size is less
|
606
|
+
* than, or equal to, the value of this keyword.
|
607
|
+
*
|
608
|
+
* @minimum 0
|
609
|
+
*/
|
610
|
+
maxItems?: number;
|
611
|
+
/**
|
612
|
+
* The value of this keyword MUST be a non-negative integer.
|
613
|
+
*
|
614
|
+
* A string instance is valid against this keyword if its length is less
|
615
|
+
* than, or equal to, the value of this keyword.
|
616
|
+
*
|
617
|
+
* The length of a string instance is defined as the number of its
|
618
|
+
* characters as defined by [RFC 8259][RFC8259].
|
619
|
+
*
|
620
|
+
* [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259
|
621
|
+
*
|
622
|
+
* @minimum 0
|
623
|
+
*/
|
624
|
+
maxLength?: number;
|
625
|
+
/**
|
626
|
+
* The value of this keyword MUST be a non-negative integer.
|
627
|
+
*
|
628
|
+
* An object instance is valid against `maxProperties` if its number of
|
629
|
+
* `properties` is less than, or equal to, the value of this keyword.
|
630
|
+
*
|
631
|
+
* @minimum 0
|
632
|
+
*/
|
633
|
+
maxProperties?: number;
|
634
|
+
/**
|
635
|
+
* The value of this keyword MUST be a non-negative integer.
|
636
|
+
*
|
637
|
+
* An array instance is valid against `minContains` if the number of
|
638
|
+
* elements that are valid against the schema for `contains` is
|
639
|
+
* greater than, or equal to, the value of this keyword.
|
640
|
+
*
|
641
|
+
* A value of `0` is allowed, but is only useful for setting a range
|
642
|
+
* of occurrences from `0` to the value of `maxContains`. A value of
|
643
|
+
* `0` with no `maxContains` causes `contains` to always pass
|
644
|
+
* validation.
|
645
|
+
*
|
646
|
+
* If `contains` is not present within the same schema object, then this
|
647
|
+
* keyword has no effect.
|
648
|
+
*
|
649
|
+
* Omitting this keyword has the same behavior as a value of `1`.
|
650
|
+
*
|
651
|
+
* @default 1
|
652
|
+
*/
|
653
|
+
minContains?: number;
|
654
|
+
/**
|
655
|
+
* The value of `minimum` MUST be a number, representing an inclusive
|
656
|
+
* lower limit for a numeric instance.
|
657
|
+
*
|
658
|
+
* If the instance is a number, then this keyword validates only if the
|
659
|
+
* instance is greater than or exactly equal to `minimum`.
|
660
|
+
*/
|
661
|
+
minimum?: number;
|
662
|
+
/**
|
663
|
+
* The value of this keyword MUST be a non-negative integer.
|
664
|
+
*
|
665
|
+
* An array instance is valid against `minItems` if its size is greater
|
666
|
+
* than, or equal to, the value of this keyword.
|
667
|
+
*
|
668
|
+
* Omitting this keyword has the same behavior as a value of `0`.
|
669
|
+
*
|
670
|
+
* @default 0
|
671
|
+
* @minimum 0
|
672
|
+
*/
|
673
|
+
minItems?: number;
|
674
|
+
/**
|
675
|
+
* The value of this keyword MUST be a non-negative integer.
|
676
|
+
*
|
677
|
+
* A string instance is valid against this keyword if its length is greater
|
678
|
+
* than, or equal to, the value of this keyword.
|
679
|
+
*
|
680
|
+
* The length of a string instance is defined as the number of its
|
681
|
+
* characters as defined by [RFC 8259][RFC8259].
|
682
|
+
*
|
683
|
+
* Omitting this keyword has the same behavior as a value of `0`.
|
684
|
+
*
|
685
|
+
* [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259
|
686
|
+
*
|
687
|
+
* @default 0
|
688
|
+
* @minimum 0
|
689
|
+
*/
|
690
|
+
minLength?: number;
|
691
|
+
/**
|
692
|
+
* The value of this keyword MUST be a non-negative integer.
|
693
|
+
*
|
694
|
+
* An object instance is valid against `minProperties` if its number of
|
695
|
+
* `properties` is greater than, or equal to, the value of this keyword.
|
696
|
+
*
|
697
|
+
* Omitting this keyword has the same behavior as a value of `0`.
|
698
|
+
*
|
699
|
+
* @default 0
|
700
|
+
* @minimum 0
|
701
|
+
*/
|
702
|
+
minProperties?: number;
|
703
|
+
/**
|
704
|
+
* The value of `multipleOf` MUST be a number, strictly greater than
|
705
|
+
* `0`.
|
706
|
+
*
|
707
|
+
* A numeric instance is valid only if division by this keyword's value
|
708
|
+
* results in an integer.
|
709
|
+
*
|
710
|
+
* @exclusiveMinimum 0
|
711
|
+
*/
|
712
|
+
multipleOf?: number;
|
713
|
+
/**
|
714
|
+
* This keyword's value MUST be a valid JSON Schema.
|
715
|
+
*
|
716
|
+
* An instance is valid against this keyword if it fails to validate
|
717
|
+
* successfully against the schema defined by this keyword.
|
718
|
+
*/
|
719
|
+
not?: JSONSchema<Value, SchemaType>;
|
720
|
+
/**
|
721
|
+
* This keyword's value MUST be a non-empty array. Each item of the array
|
722
|
+
* MUST be a valid JSON Schema.
|
723
|
+
*
|
724
|
+
* An instance validates successfully against this keyword if it validates
|
725
|
+
* successfully against exactly one schema defined by this keyword's value.
|
726
|
+
*/
|
727
|
+
oneOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;
|
728
|
+
/**
|
729
|
+
* The value of this keyword MUST be a string. This string SHOULD be a
|
730
|
+
* valid regular expression, according to the [ECMA-262][ecma262] regular
|
731
|
+
* expression dialect.
|
732
|
+
*
|
733
|
+
* A string instance is considered valid if the regular expression matches
|
734
|
+
* the instance successfully. Recall: regular expressions are not
|
735
|
+
* implicitly anchored.
|
736
|
+
*
|
737
|
+
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
|
738
|
+
*
|
739
|
+
* @format "regex"
|
740
|
+
*/
|
741
|
+
pattern?: string;
|
742
|
+
/**
|
743
|
+
* The value of `patternProperties` MUST be an object. Each property name
|
744
|
+
* of this object SHOULD be a valid regular expression, according to the
|
745
|
+
* [ECMA-262][ecma262] regular expression dialect. Each property value of
|
746
|
+
* this object MUST be a valid JSON Schema.
|
747
|
+
*
|
748
|
+
* Validation succeeds if, for each instance name that matches any regular
|
749
|
+
* expressions that appear as a property name in this keyword's value,
|
750
|
+
* the child instance for that name successfully validates against each
|
751
|
+
* schema that corresponds to a matching regular expression.
|
752
|
+
*
|
753
|
+
* The annotation result of this keyword is the set of instance property
|
754
|
+
* names matched by this keyword. Annotation results for
|
755
|
+
* `patternProperties` keywords from multiple schemas applied to the same
|
756
|
+
* instance location are combined by taking the union of the sets.
|
757
|
+
*
|
758
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
759
|
+
* object.
|
760
|
+
*
|
761
|
+
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
|
762
|
+
*/
|
763
|
+
patternProperties?: Record<string, JSONSchema>;
|
764
|
+
/**
|
765
|
+
* The value of `properties` MUST be an object. Each value of this object
|
766
|
+
* MUST be a valid JSON Schema.
|
767
|
+
*
|
768
|
+
* Validation succeeds if, for each name that appears in both the instance
|
769
|
+
* and as a name within this keyword's value, the child instance for that
|
770
|
+
* name successfully validates against the corresponding schema.
|
771
|
+
*
|
772
|
+
* The annotation result of this keyword is the set of instance property
|
773
|
+
* names matched by this keyword. Annotation results for `properties`
|
774
|
+
* keywords from multiple schemas applied to the same instance location are
|
775
|
+
* combined by taking the union of the sets.
|
776
|
+
*
|
777
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
778
|
+
* object.
|
779
|
+
*/
|
780
|
+
properties?: Record<string, JSONSchema>;
|
781
|
+
/**
|
782
|
+
* The value of `propertyNames` MUST be a valid JSON Schema.
|
783
|
+
*
|
784
|
+
* If the instance is an object, this keyword validates if every property
|
785
|
+
* name in the instance validates against the provided schema.
|
786
|
+
* Note the property name that the schema is testing will always be a
|
787
|
+
* string.
|
788
|
+
*
|
789
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
790
|
+
*/
|
791
|
+
propertyNames?: JSONSchema;
|
792
|
+
/**
|
793
|
+
* The value of this keyword MUST be a boolean. When multiple occurrences
|
794
|
+
* of this keyword are applicable to a single sub-instance, the resulting
|
795
|
+
* value MUST be `true` if any occurrence specifies a `true` value, and
|
796
|
+
* MUST be `false` otherwise.
|
797
|
+
*
|
798
|
+
* If `readOnly` has a value of boolean `true`, it indicates that the
|
799
|
+
* value of the instance is managed exclusively by the owning authority,
|
800
|
+
* and attempts by an application to modify the value of this property are
|
801
|
+
* expected to be ignored or rejected by that owning authority.
|
802
|
+
*
|
803
|
+
* An instance document that is marked as `readOnly` for the entire
|
804
|
+
* document MAY be ignored if sent to the owning authority, or MAY result
|
805
|
+
* in an error, at the authority's discretion.
|
806
|
+
*
|
807
|
+
* For example, `readOnly` would be used to mark a database-generated
|
808
|
+
* serial number as read-only.
|
809
|
+
*
|
810
|
+
* This keyword can be used to assist in user interface instance
|
811
|
+
* generation.
|
812
|
+
*
|
813
|
+
* @default false
|
814
|
+
*/
|
815
|
+
readOnly?: boolean;
|
816
|
+
/**
|
817
|
+
* The value of this keyword MUST be an array. Elements of this array, if
|
818
|
+
* any, MUST be strings, and MUST be unique.
|
819
|
+
*
|
820
|
+
* An object instance is valid against this keyword if every item in the
|
821
|
+
* array is the name of a property in the instance.
|
822
|
+
*
|
823
|
+
* Omitting this keyword has the same behavior as an empty array.
|
824
|
+
*/
|
825
|
+
required?: MaybeReadonlyArray<string>;
|
826
|
+
/**
|
827
|
+
* This keyword's value MUST be a valid JSON Schema.
|
828
|
+
*
|
829
|
+
* When `if` is present, and the instance successfully validates against
|
830
|
+
* its subschema, then validation succeeds against this keyword if the
|
831
|
+
* instance also successfully validates against this keyword's subschema.
|
832
|
+
*
|
833
|
+
* This keyword has no effect when `if` is absent, or when the instance
|
834
|
+
* fails to validate against its subschema. Implementations MUST NOT
|
835
|
+
* evaluate the instance against this keyword, for either validation or
|
836
|
+
* annotation collection purposes, in such cases.
|
837
|
+
*/
|
838
|
+
then?: JSONSchema<Value, SchemaType>;
|
839
|
+
/**
|
840
|
+
* Can be used to decorate a user interface with a short label about the
|
841
|
+
* data produced.
|
842
|
+
*/
|
843
|
+
title?: string;
|
844
|
+
/**
|
845
|
+
* The value of this keyword MUST be either a string or an array. If it is
|
846
|
+
* an array, elements of the array MUST be strings and MUST be unique.
|
847
|
+
*
|
848
|
+
* String values MUST be one of the six primitive types (`"null"`,
|
849
|
+
* `"boolean"`, `"object"`, `"array"`, `"number"`, or
|
850
|
+
* `"string"`), or `"integer"` which matches any number with a zero
|
851
|
+
* fractional part.
|
852
|
+
*
|
853
|
+
* An instance validates if and only if the instance is in any of the sets
|
854
|
+
* listed for this keyword.
|
855
|
+
*/
|
856
|
+
type?: SchemaType;
|
857
|
+
/**
|
858
|
+
* The value of `unevaluatedItems` MUST be a valid JSON Schema.
|
859
|
+
*
|
860
|
+
* The behavior of this keyword depends on the annotation results of
|
861
|
+
* adjacent keywords that apply to the instance location being validated.
|
862
|
+
* Specifically, the annotations from `items` and `additionalItems`,
|
863
|
+
* which can come from those keywords when they are adjacent to the
|
864
|
+
* `unevaluatedItems` keyword. Those two annotations, as well as
|
865
|
+
* `unevaluatedItems`, can also result from any and all adjacent
|
866
|
+
* [in-place applicator][in-place-applicator] keywords.
|
867
|
+
*
|
868
|
+
* If an `items` annotation is present, and its annotation result is a
|
869
|
+
* number, and no "additionalItems" or `unevaluatedItems` annotation is
|
870
|
+
* present, then validation succeeds if every instance element at an index
|
871
|
+
* greater than the `items` annotation validates against
|
872
|
+
* `unevaluatedItems`.
|
873
|
+
*
|
874
|
+
* Otherwise, if any `items`, `additionalItems`, or
|
875
|
+
* `unevaluatedItems` annotations are present with a value of boolean
|
876
|
+
* `true`, then `unevaluatedItems` MUST be ignored. However, if none
|
877
|
+
* of these annotations are present, `unevaluatedItems` MUST be applied
|
878
|
+
* to all locations in the array.
|
879
|
+
*
|
880
|
+
* This means that `items`, `additionalItems`, and all in-place
|
881
|
+
* applicators MUST be evaluated before this keyword can be evaluated.
|
882
|
+
* Authors of extension keywords MUST NOT define an in-place applicator
|
883
|
+
* that would need to be evaluated before this keyword.
|
884
|
+
*
|
885
|
+
* If the `unevaluatedItems` subschema is applied to any positions within
|
886
|
+
* the instance array, it produces an annotation result of boolean
|
887
|
+
* `true`, analogous to the single schema behavior of `items`. If any
|
888
|
+
* `unevaluatedItems` keyword from any subschema applied to the same
|
889
|
+
* instance location produces an annotation value of `true`, then the
|
890
|
+
* combined result from these keywords is also `true`.
|
891
|
+
*
|
892
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
893
|
+
* schema.
|
894
|
+
*
|
895
|
+
* Implementations that do not collect annotations MUST raise an error
|
896
|
+
* upon encountering this keyword.
|
897
|
+
*
|
898
|
+
* [in-place-applicator]: https://json-schema.org/draft/2019-09/json-schema-core.html#in-place
|
899
|
+
*/
|
900
|
+
unevaluatedItems?: JSONSchema;
|
901
|
+
/**
|
902
|
+
* The value of `unevaluatedProperties` MUST be a valid JSON Schema.
|
903
|
+
*
|
904
|
+
* The behavior of this keyword depends on the annotation results of
|
905
|
+
* adjacent keywords that apply to the instance location being validated.
|
906
|
+
* Specifically, the annotations from `properties`,
|
907
|
+
* `patternProperties`, and `additionalProperties`, which can come from
|
908
|
+
* those keywords when they are adjacent to the `unevaluatedProperties`
|
909
|
+
* keyword. Those three annotations, as well as `unevaluatedProperties`,
|
910
|
+
* can also result from any and all adjacent
|
911
|
+
* [in-place applicator][in-place-applicator] keywords.
|
912
|
+
*
|
913
|
+
* Validation with `unevaluatedProperties` applies only to the child
|
914
|
+
* values of instance names that do not appear in the `properties`,
|
915
|
+
* `patternProperties`, `additionalProperties`, or
|
916
|
+
* `unevaluatedProperties` annotation results that apply to the
|
917
|
+
* instance location being validated.
|
918
|
+
*
|
919
|
+
* For all such properties, validation succeeds if the child instance
|
920
|
+
* validates against the "unevaluatedProperties" schema.
|
921
|
+
*
|
922
|
+
* This means that `properties`, `patternProperties`,
|
923
|
+
* `additionalProperties`, and all in-place applicators MUST be evaluated
|
924
|
+
* before this keyword can be evaluated. Authors of extension keywords
|
925
|
+
* MUST NOT define an in-place applicator that would need to be evaluated
|
926
|
+
* before this keyword.
|
927
|
+
*
|
928
|
+
* The annotation result of this keyword is the set of instance property
|
929
|
+
* names validated by this keyword's subschema. Annotation results for
|
930
|
+
* `unevaluatedProperties` keywords from multiple schemas applied to the
|
931
|
+
* same instance location are combined by taking the union of the sets.
|
932
|
+
*
|
933
|
+
* Omitting this keyword has the same assertion behavior as an empty
|
934
|
+
* schema.
|
935
|
+
*
|
936
|
+
* Implementations that do not collect annotations MUST raise an error upon
|
937
|
+
* encountering this keyword.
|
938
|
+
*
|
939
|
+
* [in-place-applicator]: https://json-schema.org/draft/2019-09/json-schema-core.html#in-place
|
940
|
+
*/
|
941
|
+
unevaluatedProperties?: JSONSchema;
|
942
|
+
/**
|
943
|
+
* The value of this keyword MUST be a boolean.
|
944
|
+
*
|
945
|
+
* If this keyword has boolean value `false`, the instance validates
|
946
|
+
* successfully. If it has boolean value `true`, the instance validates
|
947
|
+
* successfully if all of its elements are unique.
|
948
|
+
*
|
949
|
+
* Omitting this keyword has the same behavior as a value of `false`.
|
950
|
+
*
|
951
|
+
* @default false
|
952
|
+
*/
|
953
|
+
uniqueItems?: boolean;
|
954
|
+
/**
|
955
|
+
* The value of this keyword MUST be a boolean. When multiple occurrences
|
956
|
+
* of this keyword is applicable to a single sub-instance, the resulting
|
957
|
+
* value MUST be `true` if any occurrence specifies a `true` value, and
|
958
|
+
* MUST be `false` otherwise.
|
959
|
+
*
|
960
|
+
* If `writeOnly` has a value of boolean `true`, it indicates that the
|
961
|
+
* value is never present when the instance is retrieved from the owning
|
962
|
+
* authority. It can be present when sent to the owning authority to update
|
963
|
+
* or create the document (or the resource it represents), but it will not
|
964
|
+
* be included in any updated or newly created version of the instance.
|
965
|
+
*
|
966
|
+
* An instance document that is marked as `writeOnly` for the entire
|
967
|
+
* document MAY be returned as a blank document of some sort, or MAY
|
968
|
+
* produce an error upon retrieval, or have the retrieval request ignored,
|
969
|
+
* at the authority's discretion.
|
970
|
+
*
|
971
|
+
* For example, `writeOnly` would be used to mark a password input field.
|
972
|
+
*
|
973
|
+
* These keywords can be used to assist in user interface instance
|
974
|
+
* generation. In particular, an application MAY choose to use a widget
|
975
|
+
* that hides input values as they are typed for write-only fields.
|
976
|
+
*
|
977
|
+
* @default false
|
978
|
+
*/
|
979
|
+
writeOnly?: boolean;
|
980
|
+
};
|
981
|
+
declare namespace JSONSchema {
|
982
|
+
type TypeValue = (ValueOf<TypeName> | TypeName | Array<ValueOf<TypeName> | TypeName> | ReadonlyArray<ValueOf<TypeName> | TypeName>);
|
983
|
+
/**
|
984
|
+
* JSON Schema interface
|
985
|
+
*/
|
986
|
+
type Interface<Value = any, SchemaType extends TypeValue = TypeValue> = Exclude<JSONSchema<Value, SchemaType>, boolean>;
|
987
|
+
type Array<T = any> = Pick<Interface<T, "array">, KeywordByType.Any | KeywordByType.Array>;
|
988
|
+
type Boolean = Pick<Interface<boolean, "boolean">, KeywordByType.Any>;
|
989
|
+
type Integer = Pick<Interface<number, "integer">, KeywordByType.Any | KeywordByType.Number>;
|
990
|
+
type Number = Pick<Interface<number, "number">, KeywordByType.Any | KeywordByType.Number>;
|
991
|
+
type Null = Pick<Interface<null, "null">, KeywordByType.Any>;
|
992
|
+
type Object<T = any> = Pick<Interface<T, "object">, KeywordByType.Any | KeywordByType.Object>;
|
993
|
+
type String = Pick<Interface<string, "string">, KeywordByType.Any | KeywordByType.String>;
|
994
|
+
}
|
995
|
+
declare namespace KeywordByType {
|
996
|
+
type Any = "$anchor" | "$comment" | "$defs" | "$id" | "$recursiveAnchor" | "$recursiveRef" | "$ref" | "$schema" | "$vocabulary" | "allOf" | "anyOf" | "const" | "default" | "definitions" | "deprecated" | "description" | "else" | "enum" | "examples" | "format" | "if" | "not" | "oneOf" | "readOnly" | "then" | "title" | "type" | "writeOnly";
|
997
|
+
type Array = "additionalItems" | "contains" | "items" | "maxContains" | "maxItems" | "minContains" | "minItems" | "unevaluatedItems" | "uniqueItems";
|
998
|
+
type Number = "exclusiveMaximum" | "exclusiveMinimum" | "maximum" | "minimum" | "multipleOf";
|
999
|
+
type Object = "additionalProperties" | "dependencies" | "dependentRequired" | "dependentSchemas" | "maxProperties" | "minProperties" | "patternProperties" | "properties" | "propertyNames" | "required" | "unevaluatedProperties";
|
1000
|
+
type String = "contentEncoding" | "contentMediaType" | "contentSchema" | "maxLength" | "minLength" | "pattern";
|
1001
|
+
}
|
1002
|
+
/**
|
1003
|
+
* Content encoding strategy enum.
|
1004
|
+
*
|
1005
|
+
* - [Content-Transfer-Encoding Syntax](https://datatracker.ietf.org/doc/html/rfc2045#section-6.1)
|
1006
|
+
* - [7bit vs 8bit encoding](https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705)
|
1007
|
+
*/
|
1008
|
+
declare enum ContentEncoding {
|
1009
|
+
/**
|
1010
|
+
* Only US-ASCII characters, which use the lower 7 bits for each character.
|
1011
|
+
*
|
1012
|
+
* Each line must be less than 1,000 characters.
|
1013
|
+
*/
|
1014
|
+
"7bit" = "7bit",
|
1015
|
+
/**
|
1016
|
+
* Allow extended ASCII characters which can use the 8th (highest) bit to
|
1017
|
+
* indicate special characters not available in 7bit.
|
1018
|
+
*
|
1019
|
+
* Each line must be less than 1,000 characters.
|
1020
|
+
*/
|
1021
|
+
"8bit" = "8bit",
|
1022
|
+
/**
|
1023
|
+
* Useful for data that is mostly non-text.
|
1024
|
+
*/
|
1025
|
+
Base64 = "base64",
|
1026
|
+
/**
|
1027
|
+
* Same character set as 8bit, with no line length restriction.
|
1028
|
+
*/
|
1029
|
+
Binary = "binary",
|
1030
|
+
/**
|
1031
|
+
* An extension token defined by a standards-track RFC and registered with
|
1032
|
+
* IANA.
|
1033
|
+
*/
|
1034
|
+
IETFToken = "ietf-token",
|
1035
|
+
/**
|
1036
|
+
* Lines are limited to 76 characters, and line breaks are represented using
|
1037
|
+
* special characters that are escaped.
|
1038
|
+
*/
|
1039
|
+
QuotedPrintable = "quoted-printable",
|
1040
|
+
/**
|
1041
|
+
* The two characters "X-" or "x-" followed, with no intervening white space,
|
1042
|
+
* by any token.
|
1043
|
+
*/
|
1044
|
+
XToken = "x-token"
|
1045
|
+
}
|
1046
|
+
/**
|
1047
|
+
* This enum provides well-known formats that apply to strings.
|
1048
|
+
*/
|
1049
|
+
declare enum Format {
|
1050
|
+
/**
|
1051
|
+
* A string instance is valid against this attribute if it is a valid
|
1052
|
+
* representation according to the "full-date" production in
|
1053
|
+
* [RFC 3339][RFC3339].
|
1054
|
+
*
|
1055
|
+
* [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339
|
1056
|
+
*/
|
1057
|
+
Date = "date",
|
1058
|
+
/**
|
1059
|
+
* A string instance is valid against this attribute if it is a valid
|
1060
|
+
* representation according to the "date-time" production in
|
1061
|
+
* [RFC 3339][RFC3339].
|
1062
|
+
*
|
1063
|
+
* [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339
|
1064
|
+
*/
|
1065
|
+
DateTime = "date-time",
|
1066
|
+
/**
|
1067
|
+
* A string instance is valid against this attribute if it is a valid
|
1068
|
+
* representation according to the "duration" production.
|
1069
|
+
*/
|
1070
|
+
Duration = "duration",
|
1071
|
+
/**
|
1072
|
+
* A string instance is valid against this attribute if it is a valid Internet
|
1073
|
+
* email address as defined by [RFC 5322, section 3.4.1][RFC5322].
|
1074
|
+
*
|
1075
|
+
* [RFC5322]: https://datatracker.ietf.org/doc/html/rfc5322
|
1076
|
+
*/
|
1077
|
+
Email = "email",
|
1078
|
+
/**
|
1079
|
+
* As defined by [RFC 1123, section 2.1][RFC1123], including host names
|
1080
|
+
* produced using the Punycode algorithm specified in
|
1081
|
+
* [RFC 5891, section 4.4][RFC5891].
|
1082
|
+
*
|
1083
|
+
* [RFC1123]: https://datatracker.ietf.org/doc/html/rfc1123
|
1084
|
+
* [RFC5891]: https://datatracker.ietf.org/doc/html/rfc5891
|
1085
|
+
*/
|
1086
|
+
Hostname = "hostname",
|
1087
|
+
/**
|
1088
|
+
* A string instance is valid against this attribute if it is a valid Internet
|
1089
|
+
* email address as defined by [RFC 6531][RFC6531].
|
1090
|
+
*
|
1091
|
+
* [RFC6531]: https://datatracker.ietf.org/doc/html/rfc6531
|
1092
|
+
*/
|
1093
|
+
IDNEmail = "idn-email",
|
1094
|
+
/**
|
1095
|
+
* As defined by either [RFC 1123, section 2.1][RFC1123] as for hostname, or
|
1096
|
+
* an internationalized hostname as defined by
|
1097
|
+
* [RFC 5890, section 2.3.2.3][RFC5890].
|
1098
|
+
*
|
1099
|
+
* [RFC1123]: https://datatracker.ietf.org/doc/html/rfc1123
|
1100
|
+
* [RFC5890]: https://datatracker.ietf.org/doc/html/rfc5890
|
1101
|
+
*/
|
1102
|
+
IDNHostname = "idn-hostname",
|
1103
|
+
/**
|
1104
|
+
* An IPv4 address according to the "dotted-quad" ABNF syntax as defined in
|
1105
|
+
* [RFC 2673, section 3.2][RFC2673].
|
1106
|
+
*
|
1107
|
+
* [RFC2673]: https://datatracker.ietf.org/doc/html/rfc2673
|
1108
|
+
*/
|
1109
|
+
IPv4 = "ipv4",
|
1110
|
+
/**
|
1111
|
+
* An IPv6 address as defined in [RFC 4291, section 2.2][RFC4291].
|
1112
|
+
*
|
1113
|
+
* [RFC4291]: https://datatracker.ietf.org/doc/html/rfc4291
|
1114
|
+
*/
|
1115
|
+
IPv6 = "ipv6",
|
1116
|
+
/**
|
1117
|
+
* A string instance is valid against this attribute if it is a valid IRI,
|
1118
|
+
* according to [RFC 3987][RFC3987].
|
1119
|
+
*
|
1120
|
+
* [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987
|
1121
|
+
*/
|
1122
|
+
IRI = "iri",
|
1123
|
+
/**
|
1124
|
+
* A string instance is valid against this attribute if it is a valid IRI
|
1125
|
+
* Reference (either an IRI or a relative-reference), according to
|
1126
|
+
* [RFC 3987][RFC3987].
|
1127
|
+
*
|
1128
|
+
* [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987
|
1129
|
+
*/
|
1130
|
+
IRIReference = "iri-reference",
|
1131
|
+
/**
|
1132
|
+
* A string instance is valid against this attribute if it is a valid JSON
|
1133
|
+
* string representation of a JSON Pointer, according to
|
1134
|
+
* [RFC 6901, section 5][RFC6901].
|
1135
|
+
*
|
1136
|
+
* [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901
|
1137
|
+
*/
|
1138
|
+
JSONPointer = "json-pointer",
|
1139
|
+
/**
|
1140
|
+
* A string instance is valid against this attribute if it is a valid JSON
|
1141
|
+
* string representation of a JSON Pointer fragment, according to
|
1142
|
+
* [RFC 6901, section 5][RFC6901].
|
1143
|
+
*
|
1144
|
+
* [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901
|
1145
|
+
*/
|
1146
|
+
JSONPointerURIFragment = "json-pointer-uri-fragment",
|
1147
|
+
/**
|
1148
|
+
* This attribute applies to string instances.
|
1149
|
+
*
|
1150
|
+
* A regular expression, which SHOULD be valid according to the
|
1151
|
+
* [ECMA-262][ecma262] regular expression dialect.
|
1152
|
+
*
|
1153
|
+
* Implementations that validate formats MUST accept at least the subset of
|
1154
|
+
* [ECMA-262][ecma262] defined in the [Regular Expressions][regexInterop]
|
1155
|
+
* section of this specification, and SHOULD accept all valid
|
1156
|
+
* [ECMA-262][ecma262] expressions.
|
1157
|
+
*
|
1158
|
+
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
|
1159
|
+
* [regexInterop]: https://json-schema.org/draft/2019-09/json-schema-validation.html#regexInterop
|
1160
|
+
*/
|
1161
|
+
RegEx = "regex",
|
1162
|
+
/**
|
1163
|
+
* A string instance is valid against this attribute if it is a valid
|
1164
|
+
* [Relative JSON Pointer][relative-json-pointer].
|
1165
|
+
*
|
1166
|
+
* [relative-json-pointer]: https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01
|
1167
|
+
*/
|
1168
|
+
RelativeJSONPointer = "relative-json-pointer",
|
1169
|
+
/**
|
1170
|
+
* A string instance is valid against this attribute if it is a valid
|
1171
|
+
* representation according to the "time" production in [RFC 3339][RFC3339].
|
1172
|
+
*
|
1173
|
+
* [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339
|
1174
|
+
*/
|
1175
|
+
Time = "time",
|
1176
|
+
/**
|
1177
|
+
* A string instance is valid against this attribute if it is a valid URI,
|
1178
|
+
* according to [RFC3986][RFC3986].
|
1179
|
+
*
|
1180
|
+
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
|
1181
|
+
*/
|
1182
|
+
URI = "uri",
|
1183
|
+
/**
|
1184
|
+
* A string instance is valid against this attribute if it is a valid URI
|
1185
|
+
* Reference (either a URI or a relative-reference), according to
|
1186
|
+
* [RFC3986][RFC3986].
|
1187
|
+
*
|
1188
|
+
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
|
1189
|
+
*/
|
1190
|
+
URIReference = "uri-reference",
|
1191
|
+
/**
|
1192
|
+
* A string instance is valid against this attribute if it is a valid URI
|
1193
|
+
* Template (of any level), according to [RFC 6570][RFC6570].
|
1194
|
+
*
|
1195
|
+
* Note that URI Templates may be used for IRIs; there is no separate IRI
|
1196
|
+
* Template specification.
|
1197
|
+
*
|
1198
|
+
* [RFC6570]: https://datatracker.ietf.org/doc/html/rfc6570
|
1199
|
+
*/
|
1200
|
+
URITemplate = "uri-template",
|
1201
|
+
/**
|
1202
|
+
* A string instance is valid against this attribute if it is a valid string
|
1203
|
+
* representation of a UUID, according to [RFC 4122][RFC4122].
|
1204
|
+
*
|
1205
|
+
* [RFC4122]: https://datatracker.ietf.org/doc/html/rfc4122
|
1206
|
+
*/
|
1207
|
+
UUID = "uuid"
|
1208
|
+
}
|
1209
|
+
/**
|
1210
|
+
* Enum consisting of simple type names for the `type` keyword
|
1211
|
+
*/
|
1212
|
+
declare enum TypeName {
|
1213
|
+
/**
|
1214
|
+
* Value MUST be an array.
|
1215
|
+
*/
|
1216
|
+
Array = "array",
|
1217
|
+
/**
|
1218
|
+
* Value MUST be a boolean.
|
1219
|
+
*/
|
1220
|
+
Boolean = "boolean",
|
1221
|
+
/**
|
1222
|
+
* Value MUST be an integer, no floating point numbers are allowed. This is a
|
1223
|
+
* subset of the number type.
|
1224
|
+
*/
|
1225
|
+
Integer = "integer",
|
1226
|
+
/**
|
1227
|
+
* Value MUST be null. Note this is mainly for purpose of being able use union
|
1228
|
+
* types to define nullability. If this type is not included in a union, null
|
1229
|
+
* values are not allowed (the primitives listed above do not allow nulls on
|
1230
|
+
* their own).
|
1231
|
+
*/
|
1232
|
+
Null = "null",
|
1233
|
+
/**
|
1234
|
+
* Value MUST be a number, floating point numbers are allowed.
|
1235
|
+
*/
|
1236
|
+
Number = "number",
|
1237
|
+
/**
|
1238
|
+
* Value MUST be an object.
|
1239
|
+
*/
|
1240
|
+
Object = "object",
|
1241
|
+
/**
|
1242
|
+
* Value MUST be a string.
|
1243
|
+
*/
|
1244
|
+
String = "string"
|
1245
|
+
}
|
1246
|
+
declare const keywords: readonly ["$anchor", "$comment", "$defs", "$id", "$recursiveAnchor", "$recursiveRef", "$ref", "$schema", "$vocabulary", "additionalItems", "additionalProperties", "allOf", "anyOf", "const", "contains", "contentEncoding", "contentMediaType", "contentSchema", "default", "definitions", "dependencies", "dependentRequired", "dependentSchemas", "deprecated", "description", "else", "enum", "examples", "exclusiveMaximum", "exclusiveMinimum", "format", "if", "items", "maxContains", "maximum", "maxItems", "maxLength", "maxProperties", "minContains", "minimum", "minItems", "minLength", "minProperties", "multipleOf", "not", "oneOf", "pattern", "patternProperties", "properties", "propertyNames", "readOnly", "required", "then", "title", "type", "unevaluatedItems", "unevaluatedProperties", "uniqueItems", "writeOnly"];
|
1247
|
+
|
1248
|
+
export { $schema, ContentEncoding, Format, JSONSchema, TypeName, draft, keywords };
|