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