@powerlines/schema 0.11.81 → 0.11.82
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/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/bundle.cjs +49 -0
- package/dist/bundle.d.cts +21 -0
- package/dist/bundle.d.cts.map +1 -0
- package/dist/bundle.d.mts +21 -0
- package/dist/bundle.d.mts.map +1 -0
- package/dist/bundle.mjs +48 -0
- package/dist/bundle.mjs.map +1 -0
- package/dist/codegen.cjs +312 -0
- package/dist/codegen.d.cts +67 -0
- package/dist/codegen.d.cts.map +1 -0
- package/dist/codegen.d.mts +67 -0
- package/dist/codegen.d.mts.map +1 -0
- package/dist/codegen.mjs +306 -0
- package/dist/codegen.mjs.map +1 -0
- package/dist/constants.cjs +61 -0
- package/dist/constants.d.cts +17 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +17 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +57 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/extract.cjs +482 -0
- package/dist/extract.d.cts +125 -0
- package/dist/extract.d.cts.map +1 -0
- package/dist/extract.d.mts +125 -0
- package/dist/extract.d.mts.map +1 -0
- package/dist/extract.mjs +472 -0
- package/dist/extract.mjs.map +1 -0
- package/dist/helpers.cjs +241 -0
- package/dist/helpers.d.cts +121 -0
- package/dist/helpers.d.cts.map +1 -0
- package/dist/helpers.d.mts +121 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +234 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/index.cjs +95 -2434
- package/dist/index.d.cts +11 -1892
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +11 -1892
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -2321
- package/dist/metadata.cjs +53 -0
- package/dist/metadata.d.cts +31 -0
- package/dist/metadata.d.cts.map +1 -0
- package/dist/metadata.d.mts +31 -0
- package/dist/metadata.d.mts.map +1 -0
- package/dist/metadata.mjs +52 -0
- package/dist/metadata.mjs.map +1 -0
- package/dist/persistence.cjs +74 -0
- package/dist/persistence.d.cts +47 -0
- package/dist/persistence.d.cts.map +1 -0
- package/dist/persistence.d.mts +47 -0
- package/dist/persistence.d.mts.map +1 -0
- package/dist/persistence.mjs +71 -0
- package/dist/persistence.mjs.map +1 -0
- package/dist/reflection.cjs +426 -0
- package/dist/reflection.d.cts +11 -0
- package/dist/reflection.d.cts.map +1 -0
- package/dist/reflection.d.mts +11 -0
- package/dist/reflection.d.mts.map +1 -0
- package/dist/reflection.mjs +425 -0
- package/dist/reflection.mjs.map +1 -0
- package/dist/resolve.cjs +105 -0
- package/dist/resolve.d.cts +36 -0
- package/dist/resolve.d.cts.map +1 -0
- package/dist/resolve.d.mts +36 -0
- package/dist/resolve.d.mts.map +1 -0
- package/dist/resolve.mjs +102 -0
- package/dist/resolve.mjs.map +1 -0
- package/dist/type-checks.cjs +633 -0
- package/dist/type-checks.d.cts +316 -0
- package/dist/type-checks.d.cts.map +1 -0
- package/dist/type-checks.d.mts +316 -0
- package/dist/type-checks.d.mts.map +1 -0
- package/dist/type-checks.mjs +594 -0
- package/dist/type-checks.mjs.map +1 -0
- package/dist/types.d.cts +1152 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +1152 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/validate.cjs +27 -0
- package/dist/validate.mjs +25 -0
- package/dist/validate.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/index.mjs.map +0 -1
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,1152 @@
|
|
|
1
|
+
import { JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES } from "./constants.cjs";
|
|
2
|
+
import { Type } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
import { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
import { FileReferenceInput } from "@stryke/types/configuration";
|
|
5
|
+
import { InputObject, Schema } from "untyped";
|
|
6
|
+
import { BaseIssue, BaseSchema } from "valibot";
|
|
7
|
+
import * as z3 from "zod/v3";
|
|
8
|
+
|
|
9
|
+
//#region src/types.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Alias for the Untyped object-input schema shape.
|
|
12
|
+
*/
|
|
13
|
+
type UntypedInputObject = InputObject;
|
|
14
|
+
/**
|
|
15
|
+
* Alias for the Untyped schema document shape.
|
|
16
|
+
*/
|
|
17
|
+
type UntypedSchema = Schema;
|
|
18
|
+
/**
|
|
19
|
+
* A Valibot schema instance.
|
|
20
|
+
*
|
|
21
|
+
* @template TInput - The raw input type accepted by the schema.
|
|
22
|
+
* @template TOutput - The parsed output type produced by the schema.
|
|
23
|
+
* @template TIssue - The issue type emitted for validation errors.
|
|
24
|
+
*/
|
|
25
|
+
type ValibotSchema<TInput = unknown, TOutput = unknown, TIssue extends BaseIssue<unknown> = BaseIssue<unknown>> = BaseSchema<TInput, TOutput, TIssue>;
|
|
26
|
+
/**
|
|
27
|
+
* Primitive JSON Schema `type` keyword values.
|
|
28
|
+
*
|
|
29
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-7.6.1
|
|
30
|
+
*/
|
|
31
|
+
type JsonSchemaPrimitiveType = (typeof JSON_SCHEMA_PRIMITIVE_TYPES)[number];
|
|
32
|
+
/**
|
|
33
|
+
* JSON Schema type names for the `type` keyword.
|
|
34
|
+
*
|
|
35
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-7.6.1
|
|
36
|
+
*/
|
|
37
|
+
type JsonSchemaType = (typeof JSON_SCHEMA_TYPES)[number];
|
|
38
|
+
/**
|
|
39
|
+
* Semantic format names for JSON Schema integer types.
|
|
40
|
+
*/
|
|
41
|
+
type JsonSchemaIntegerFormat = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "int64" | "uint64";
|
|
42
|
+
/**
|
|
43
|
+
* Semantic format names for JSON Schema decimal types.
|
|
44
|
+
*/
|
|
45
|
+
type JsonSchemaDecimalFormat = "float" | "double";
|
|
46
|
+
/**
|
|
47
|
+
* Semantic format names for JSON Schema numeric types, including both integer and decimal formats.
|
|
48
|
+
*/
|
|
49
|
+
type JsonSchemaNumberFormat = JsonSchemaDecimalFormat | JsonSchemaIntegerFormat;
|
|
50
|
+
/**
|
|
51
|
+
* Semantic format names for JSON Schema string types.
|
|
52
|
+
*/
|
|
53
|
+
type JsonSchemaStringFormat = "binary" | "date" | "time" | "date-time" | "iso-time" | "iso-date-time" | "duration" | "uri" | "uri-reference" | "uri-template" | "url" | "email" | "hostname" | "ipv4" | "ipv6" | "regex" | "uuid" | "json-pointer" | "json-pointer-uri-fragment" | "relative-json-pointer" | "byte" | "password";
|
|
54
|
+
/**
|
|
55
|
+
* Metadata and annotation keywords shared across JSON Schema shapes.
|
|
56
|
+
*
|
|
57
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8
|
|
58
|
+
*/
|
|
59
|
+
interface JsonSchemaMetadataKeywords {
|
|
60
|
+
/**
|
|
61
|
+
* A unique identifier keyword that is used to identify a schema and can be used for referencing the schema within other schemas. It is a URI that serves as a unique identifier for the schema.
|
|
62
|
+
*
|
|
63
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.1
|
|
64
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.1
|
|
65
|
+
*/
|
|
66
|
+
$id?: string;
|
|
67
|
+
/**
|
|
68
|
+
* A keyword used to specify the version of the JSON Schema specification that the schema adheres to. It is a URI that indicates which version of the JSON Schema specification the schema is written against.
|
|
69
|
+
*
|
|
70
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.1.1
|
|
71
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.2
|
|
72
|
+
*/
|
|
73
|
+
$schema?: string;
|
|
74
|
+
/**
|
|
75
|
+
* A keyword that is used in meta-schemas to identify the vocabularies available for use in schemas described by that meta-schema.
|
|
76
|
+
*
|
|
77
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.1.2
|
|
78
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.2
|
|
79
|
+
*/
|
|
80
|
+
$vocabulary?: Record<string, boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* A comment or annotation for the schema, which can be used to provide additional context or information about the schema. It allows schema authors to include human-readable explanations or notes within the schema without affecting its validation behavior.
|
|
83
|
+
*
|
|
84
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.3
|
|
85
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.3
|
|
86
|
+
*/
|
|
87
|
+
$comment?: string;
|
|
88
|
+
/**
|
|
89
|
+
* A plain-name fragment identifier for the schema resource.
|
|
90
|
+
*
|
|
91
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.2
|
|
92
|
+
*/
|
|
93
|
+
$anchor?: string;
|
|
94
|
+
/**
|
|
95
|
+
* The `$defs` keyword is used to define reusable sub-schemas within a JSON Schema. It allows you to define sub-schemas that can be referenced elsewhere in the schema using the `$ref` keyword. The `$defs` keyword is an object where each key is a unique identifier for the sub-schema, and the value is the sub-schema itself.
|
|
96
|
+
*
|
|
97
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.4
|
|
98
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.4
|
|
99
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
100
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
101
|
+
*/
|
|
102
|
+
$defs?: Record<string, JsonSchema>;
|
|
103
|
+
/**
|
|
104
|
+
* The `$dynamicRef` keyword is used to reference a dynamic anchor defined in a JSON Schema. It allows you to reference a sub-schema that is determined at runtime based on the context of the validation. The value of `$dynamicRef` is a URI that points to the dynamic anchor defined using the `$dynamicAnchor` keyword.
|
|
105
|
+
*
|
|
106
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.3.2
|
|
107
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.6
|
|
108
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.7
|
|
109
|
+
*/
|
|
110
|
+
$dynamicRef?: string;
|
|
111
|
+
/**
|
|
112
|
+
* The `$dynamicAnchor` keyword is used to define a dynamic anchor within a JSON Schema. A dynamic anchor is a placeholder that can be referenced using the `$dynamicRef` keyword. It allows for more flexible referencing of sub-schemas, as the actual schema that the dynamic anchor points to can be determined at runtime based on the context of the validation.
|
|
113
|
+
*
|
|
114
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.6
|
|
115
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.7
|
|
116
|
+
*/
|
|
117
|
+
$dynamicAnchor?: string;
|
|
118
|
+
/**
|
|
119
|
+
* A name for the schema, which can be used by documentation tools or other libraries that support this feature to provide a human-readable name or description for the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
120
|
+
*/
|
|
121
|
+
name?: string;
|
|
122
|
+
/**
|
|
123
|
+
* A title for the schema, which can be used by documentation tools or other libraries that support this feature to provide a human-readable name or description for the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
124
|
+
*/
|
|
125
|
+
title?: string;
|
|
126
|
+
/**
|
|
127
|
+
* A description for the schema, which can be used by documentation tools or other libraries that support this feature to provide a human-readable explanation or summary of the schema's purpose and usage. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
128
|
+
*/
|
|
129
|
+
description?: string;
|
|
130
|
+
/**
|
|
131
|
+
* A URL to external documentation for the schema, which can be used by documentation tools or other libraries that support this feature to provide additional information or resources related to the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
132
|
+
*/
|
|
133
|
+
docs?: string;
|
|
134
|
+
/**
|
|
135
|
+
* An array of example values that conform to the schema. This property can be used to provide sample data for documentation purposes or to assist developers in understanding the expected structure and content of the data that the schema represents. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
136
|
+
*/
|
|
137
|
+
examples?: unknown[];
|
|
138
|
+
/**
|
|
139
|
+
* An array of strings or an alias reference to indicate that the field is an alias for one or more other fields.
|
|
140
|
+
*/
|
|
141
|
+
alias?: string[];
|
|
142
|
+
/**
|
|
143
|
+
* An array of strings indicating groups that the schema belongs to. This property can be used for organizational or categorization purposes in documentation tools or other libraries that support this feature. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
144
|
+
*/
|
|
145
|
+
tags?: string[];
|
|
146
|
+
/**
|
|
147
|
+
* An indicator specifying if the field is deprecated or not. This property can be used by documentation tools or other libraries that support this feature to provide additional information or warnings about the usage of the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
148
|
+
*/
|
|
149
|
+
deprecated?: boolean | string | {
|
|
150
|
+
message?: string;
|
|
151
|
+
since?: string;
|
|
152
|
+
alternative?: string;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* An indicator specifying if the field should be marked as hidden or not. This property can be used by documentation tools or other libraries that support this feature to provide additional information or warnings about the usage of the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
156
|
+
*/
|
|
157
|
+
hidden?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* An indicator specifying if the field should be ignored or not. This property can be used by documentation tools or other libraries that support this feature to provide additional information or warnings about the usage of the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
160
|
+
*/
|
|
161
|
+
ignore?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* An indicator specifying if the field is internal or not.
|
|
164
|
+
*
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
internal?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* An indicator specifying if the field should only be populated at runtime or not.
|
|
170
|
+
*/
|
|
171
|
+
runtime?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* An indicator specifying if the field is read-only or not.
|
|
174
|
+
*/
|
|
175
|
+
readOnly?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* An indicator specifying if the field is write-only or not. This property can be used by documentation tools or other libraries that support this feature to provide additional information or warnings about the usage of the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
178
|
+
*/
|
|
179
|
+
writeOnly?: boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A keyword group corresponding to logical operators for combining or modifying the boolean assertion results of the subschemas. They have no direct impact on annotation collection, although they enable the same annotation keyword to be applied to an instance location with different values.
|
|
183
|
+
*
|
|
184
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.1
|
|
185
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.5
|
|
186
|
+
*/
|
|
187
|
+
interface JsonSchemaLogicKeywords {
|
|
188
|
+
/**
|
|
189
|
+
* A set of schemas where the data must satisfy all members.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* An instance validates successfully against this keyword if it validates successfully against all schemas defined by this keyword's value.
|
|
193
|
+
*
|
|
194
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.1.1
|
|
195
|
+
*/
|
|
196
|
+
allOf?: JsonSchema[];
|
|
197
|
+
/**
|
|
198
|
+
* A set of schemas where the data must satisfy at least one member.
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* An instance validates successfully against this keyword if it validates successfully against at least one schema defined by this keyword's value. Note that when annotations are being collected, all subschemas **MUST** be examined so that annotations are collected from each subschema that validates successfully.
|
|
202
|
+
*
|
|
203
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.1.2
|
|
204
|
+
*/
|
|
205
|
+
anyOf?: JsonSchema[];
|
|
206
|
+
/**
|
|
207
|
+
* A set of schemas where the data must satisfy exactly one member.
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* An instance validates successfully against this keyword if it validates successfully against exactly one schema defined by this keyword's value.
|
|
211
|
+
*
|
|
212
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.1.3
|
|
213
|
+
*/
|
|
214
|
+
oneOf?: JsonSchema[];
|
|
215
|
+
/**
|
|
216
|
+
* A schema that must not match the data.
|
|
217
|
+
*
|
|
218
|
+
* @remarks
|
|
219
|
+
* An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword
|
|
220
|
+
*
|
|
221
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.1.4
|
|
222
|
+
*/
|
|
223
|
+
not?: JsonSchema;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* A set of JSON Schema keywords that define conditional combination rules for schemas. These keywords work together to implement conditional application of a subschema based on the outcome of another subschema.
|
|
227
|
+
*
|
|
228
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.2
|
|
229
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.5
|
|
230
|
+
*/
|
|
231
|
+
interface JsonSchemaConditionalKeywords {
|
|
232
|
+
/**
|
|
233
|
+
* A schema that the data must not satisfy.
|
|
234
|
+
*
|
|
235
|
+
* @remarks
|
|
236
|
+
* Instances that successfully validate against this keyword's subschema **MUST** also be valid against the subschema value of the {@link then} keyword, if present. Instances that fail to validate against this keyword's subschema **MUST** also be valid against the subschema value of the {@link else} keyword, if present.
|
|
237
|
+
*
|
|
238
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.2.1
|
|
239
|
+
*/
|
|
240
|
+
if?: JsonSchema;
|
|
241
|
+
/**
|
|
242
|
+
* A schema applied when {@link if} matches.
|
|
243
|
+
*
|
|
244
|
+
* @remarks
|
|
245
|
+
* When {@link if} is present, and the instance successfully validates against its subschema, then validation succeeds against this keyword if the instance also successfully validates against this keyword's subschema.
|
|
246
|
+
*
|
|
247
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.2.2
|
|
248
|
+
*/
|
|
249
|
+
then?: JsonSchema;
|
|
250
|
+
/**
|
|
251
|
+
* A schema applied when {@link if} does not match.
|
|
252
|
+
*
|
|
253
|
+
* @remarks
|
|
254
|
+
* When {@link if} is present, and the instance fails to validate against its subschema, then validation succeeds against this keyword if the instance successfully validates against this keyword's subschema.
|
|
255
|
+
*
|
|
256
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.2.3
|
|
257
|
+
*/
|
|
258
|
+
else?: JsonSchema;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Shared JSON Schema keyword groups applied to most schema variants.
|
|
262
|
+
*/
|
|
263
|
+
type JsonSchemaKeywords = JsonSchemaMetadataKeywords & JsonSchemaLogicKeywords & JsonSchemaConditionalKeywords;
|
|
264
|
+
/**
|
|
265
|
+
* A schema that can point to another schema via `$ref`.
|
|
266
|
+
*/
|
|
267
|
+
interface JsonSchemaAny extends JsonSchemaKeywords {
|
|
268
|
+
/**
|
|
269
|
+
* A URI reference to another schema.
|
|
270
|
+
*
|
|
271
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.3.1
|
|
272
|
+
*/
|
|
273
|
+
$ref?: string;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* JSON Schema keywords for array validation.
|
|
277
|
+
*
|
|
278
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1
|
|
279
|
+
*/
|
|
280
|
+
interface JsonSchemaArray extends JsonSchemaKeywords {
|
|
281
|
+
/**
|
|
282
|
+
* Declares that the instance must be an array.
|
|
283
|
+
*/
|
|
284
|
+
type: "array";
|
|
285
|
+
/**
|
|
286
|
+
* Schemas for positional items at each tuple index.
|
|
287
|
+
*
|
|
288
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1.1
|
|
289
|
+
*/
|
|
290
|
+
prefixItems?: JsonSchema[];
|
|
291
|
+
/**
|
|
292
|
+
* Schema for array items beyond `prefixItems`, or all items when `prefixItems` is omitted.
|
|
293
|
+
*
|
|
294
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1.2
|
|
295
|
+
*/
|
|
296
|
+
items?: JsonSchema;
|
|
297
|
+
/**
|
|
298
|
+
* A subschema that at least one array item must satisfy.
|
|
299
|
+
*
|
|
300
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1.3
|
|
301
|
+
*/
|
|
302
|
+
contains?: JsonSchema;
|
|
303
|
+
/**
|
|
304
|
+
* Minimum number of items allowed.
|
|
305
|
+
*/
|
|
306
|
+
minItems?: number;
|
|
307
|
+
/**
|
|
308
|
+
* Maximum number of items allowed.
|
|
309
|
+
*/
|
|
310
|
+
maxItems?: number;
|
|
311
|
+
/**
|
|
312
|
+
* Whether all items must be unique.
|
|
313
|
+
*/
|
|
314
|
+
uniqueItems?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Minimum count of items that must satisfy `contains`.
|
|
317
|
+
*/
|
|
318
|
+
minContains?: number;
|
|
319
|
+
/**
|
|
320
|
+
* Maximum count of items that may satisfy `contains`.
|
|
321
|
+
*/
|
|
322
|
+
maxContains?: number;
|
|
323
|
+
/**
|
|
324
|
+
* Controls validation of array items not covered by prior applicators.
|
|
325
|
+
*
|
|
326
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-11.2
|
|
327
|
+
*/
|
|
328
|
+
unevaluatedItems?: boolean | JsonSchema;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Integer schema specialized for 64-bit integer semantics.
|
|
332
|
+
*/
|
|
333
|
+
interface JsonSchemaBigint extends JsonSchemaKeywords {
|
|
334
|
+
/**
|
|
335
|
+
* Declares that the instance must be an integer.
|
|
336
|
+
*/
|
|
337
|
+
type: "integer";
|
|
338
|
+
/**
|
|
339
|
+
* Identifies an `int64` integer representation.
|
|
340
|
+
*/
|
|
341
|
+
format: "int64";
|
|
342
|
+
/**
|
|
343
|
+
* Inclusive lower bound for valid values.
|
|
344
|
+
*/
|
|
345
|
+
minimum?: bigint;
|
|
346
|
+
/**
|
|
347
|
+
* Exclusive lower bound for valid values.
|
|
348
|
+
*/
|
|
349
|
+
exclusiveMinimum?: bigint;
|
|
350
|
+
/**
|
|
351
|
+
* Inclusive upper bound for valid values.
|
|
352
|
+
*/
|
|
353
|
+
maximum?: bigint;
|
|
354
|
+
/**
|
|
355
|
+
* Exclusive upper bound for valid values.
|
|
356
|
+
*/
|
|
357
|
+
exclusiveMaximum?: bigint;
|
|
358
|
+
/**
|
|
359
|
+
* Constraint requiring values to be divisible by this number.
|
|
360
|
+
*/
|
|
361
|
+
multipleOf?: bigint;
|
|
362
|
+
/**
|
|
363
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
364
|
+
*
|
|
365
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
366
|
+
*/
|
|
367
|
+
default?: bigint;
|
|
368
|
+
/**
|
|
369
|
+
* Fixed set of allowed integer values.
|
|
370
|
+
*/
|
|
371
|
+
enum?: bigint[];
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Boolean schema keywords.
|
|
375
|
+
*/
|
|
376
|
+
interface JsonSchemaBoolean extends JsonSchemaKeywords {
|
|
377
|
+
/**
|
|
378
|
+
* Declares that the instance must be a boolean.
|
|
379
|
+
*/
|
|
380
|
+
type: "boolean";
|
|
381
|
+
/**
|
|
382
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
383
|
+
*
|
|
384
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
385
|
+
*/
|
|
386
|
+
default?: boolean;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Date and time schema variants.
|
|
390
|
+
*
|
|
391
|
+
* @remarks
|
|
392
|
+
* This type supports either direct date/time format constraints or recursive unions through `anyOf`.
|
|
393
|
+
*
|
|
394
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-validation#section-7
|
|
395
|
+
*/
|
|
396
|
+
type JsonSchemaDate = JsonSchemaKeywords & ({
|
|
397
|
+
/**
|
|
398
|
+
* Declares the storage type used for temporal values.
|
|
399
|
+
*/
|
|
400
|
+
type: "integer" | "string";
|
|
401
|
+
/**
|
|
402
|
+
* A date/time format name used for semantic validation.
|
|
403
|
+
*/
|
|
404
|
+
format: "date" | "time" | "date-time" | "iso-time" | "iso-date-time" | "unix-time";
|
|
405
|
+
/**
|
|
406
|
+
* Inclusive lower bound for numeric time representations.
|
|
407
|
+
*/
|
|
408
|
+
minimum?: number;
|
|
409
|
+
/**
|
|
410
|
+
* Inclusive upper bound for numeric time representations.
|
|
411
|
+
*/
|
|
412
|
+
maximum?: number;
|
|
413
|
+
/**
|
|
414
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
415
|
+
*
|
|
416
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
417
|
+
*/
|
|
418
|
+
default?: string | number;
|
|
419
|
+
} | {
|
|
420
|
+
/**
|
|
421
|
+
* Alternative date/time schemas where at least one must match.
|
|
422
|
+
*/
|
|
423
|
+
anyOf: JsonSchemaDate[];
|
|
424
|
+
});
|
|
425
|
+
/**
|
|
426
|
+
* Enum-constrained schema.
|
|
427
|
+
*
|
|
428
|
+
* @template T - The literal type allowed by the enum values.
|
|
429
|
+
*/
|
|
430
|
+
interface JsonSchemaEnum<T extends string | number | bigint | boolean | null = string | number | bigint | boolean | null> extends JsonSchemaKeywords {
|
|
431
|
+
/**
|
|
432
|
+
* Primitive type of the enum values.
|
|
433
|
+
*/
|
|
434
|
+
type: JsonSchemaPrimitiveType;
|
|
435
|
+
/**
|
|
436
|
+
* The complete set of allowed literal values.
|
|
437
|
+
*/
|
|
438
|
+
enum: T[];
|
|
439
|
+
/**
|
|
440
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
441
|
+
*
|
|
442
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
443
|
+
*/
|
|
444
|
+
default?: T;
|
|
445
|
+
}
|
|
446
|
+
interface JsonSchemaAllOf extends JsonSchemaKeywords {
|
|
447
|
+
/**
|
|
448
|
+
* Subschemas that must all validate successfully.
|
|
449
|
+
*/
|
|
450
|
+
allOf: JsonSchema[];
|
|
451
|
+
/**
|
|
452
|
+
* Controls validation for object properties not evaluated by prior keywords.
|
|
453
|
+
*/
|
|
454
|
+
unevaluatedProperties?: boolean | JsonSchema;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* A schema that matches exactly one literal value.
|
|
458
|
+
*/
|
|
459
|
+
interface JsonSchemaLiteral extends JsonSchemaKeywords {
|
|
460
|
+
/**
|
|
461
|
+
* Constant value that an instance must equal.
|
|
462
|
+
*/
|
|
463
|
+
const: unknown;
|
|
464
|
+
/**
|
|
465
|
+
* Optional explicit type constraint for the constant.
|
|
466
|
+
*/
|
|
467
|
+
type?: JsonSchemaType | JsonSchemaType[];
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Array representation for map-like entries as `[key, value]` tuples.
|
|
471
|
+
*/
|
|
472
|
+
interface JsonSchemaMap extends JsonSchemaKeywords {
|
|
473
|
+
/**
|
|
474
|
+
* Declares that the map is represented as an array.
|
|
475
|
+
*/
|
|
476
|
+
type: "array";
|
|
477
|
+
/**
|
|
478
|
+
* Maximum number of entries allowed.
|
|
479
|
+
*/
|
|
480
|
+
maxItems: 125;
|
|
481
|
+
/**
|
|
482
|
+
* Tuple schema describing each map entry as `[key, value]`.
|
|
483
|
+
*/
|
|
484
|
+
items: {
|
|
485
|
+
/**
|
|
486
|
+
* Declares that each entry is an array tuple.
|
|
487
|
+
*/
|
|
488
|
+
type: "array";
|
|
489
|
+
/**
|
|
490
|
+
* Two-position tuple schemas for key and value.
|
|
491
|
+
*/
|
|
492
|
+
prefixItems: [JsonSchema, JsonSchema];
|
|
493
|
+
/**
|
|
494
|
+
* Disallows additional tuple positions.
|
|
495
|
+
*/
|
|
496
|
+
items?: false;
|
|
497
|
+
/**
|
|
498
|
+
* Minimum tuple length.
|
|
499
|
+
*/
|
|
500
|
+
minItems: 2;
|
|
501
|
+
/**
|
|
502
|
+
* Maximum tuple length.
|
|
503
|
+
*/
|
|
504
|
+
maxItems: 2;
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Enum schema that allows both string and numeric enum members.
|
|
509
|
+
*/
|
|
510
|
+
interface JsonSchemaNativeEnum extends JsonSchemaKeywords {
|
|
511
|
+
/**
|
|
512
|
+
* Type domain allowed by the native enum.
|
|
513
|
+
*/
|
|
514
|
+
type: "string" | "number" | ["string", "number"];
|
|
515
|
+
/**
|
|
516
|
+
* Allowed enum member values.
|
|
517
|
+
*/
|
|
518
|
+
enum: (string | number)[];
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* A schema that intentionally matches no values.
|
|
522
|
+
*/
|
|
523
|
+
interface JsonSchemaNever extends JsonSchemaKeywords {
|
|
524
|
+
/**
|
|
525
|
+
* Negated schema used to make validation impossible.
|
|
526
|
+
*/
|
|
527
|
+
not: JsonSchemaAny;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Schema representing the JSON `null` literal type.
|
|
531
|
+
*/
|
|
532
|
+
interface JsonSchemaNull extends JsonSchemaKeywords {
|
|
533
|
+
/**
|
|
534
|
+
* The JSON Schema null type. This property is used to indicate that the schema represents a null value, which is a special value in JSON that represents the absence of a value or a null reference. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
535
|
+
*/
|
|
536
|
+
type: "null";
|
|
537
|
+
/**
|
|
538
|
+
* A constant value constrained to null when the schema is nullable.
|
|
539
|
+
*/
|
|
540
|
+
const?: null;
|
|
541
|
+
/**
|
|
542
|
+
* Allowed values, including null when the schema is nullable.
|
|
543
|
+
*/
|
|
544
|
+
enum?: null[];
|
|
545
|
+
/**
|
|
546
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
547
|
+
*
|
|
548
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
549
|
+
*/
|
|
550
|
+
default?: null;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Nullable schema variants that include an explicit `null` branch.
|
|
554
|
+
*/
|
|
555
|
+
type JsonSchemaNullable = JsonSchemaKeywords & ({
|
|
556
|
+
/**
|
|
557
|
+
* Two-branch union that includes a non-null schema and explicit `null` schema.
|
|
558
|
+
*/
|
|
559
|
+
anyOf: [JsonSchema, JsonSchemaNull];
|
|
560
|
+
} | {
|
|
561
|
+
/**
|
|
562
|
+
* Primitive `type` tuple that explicitly includes `null`.
|
|
563
|
+
*/
|
|
564
|
+
type: [Exclude<JsonSchemaType, "null">, "null"] | ["null", Exclude<JsonSchemaType, "null">];
|
|
565
|
+
});
|
|
566
|
+
/**
|
|
567
|
+
* Numeric schema keywords for numbers and integers.
|
|
568
|
+
*
|
|
569
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
570
|
+
*/
|
|
571
|
+
interface JsonSchemaNumber extends JsonSchemaKeywords {
|
|
572
|
+
/**
|
|
573
|
+
* Declares whether values are numbers or integers.
|
|
574
|
+
*/
|
|
575
|
+
type: "number" | "integer";
|
|
576
|
+
/**
|
|
577
|
+
* Optional semantic format for numeric values.
|
|
578
|
+
*/
|
|
579
|
+
format?: JsonSchemaNumberFormat | string;
|
|
580
|
+
/**
|
|
581
|
+
* Inclusive lower bound for numeric values.
|
|
582
|
+
*/
|
|
583
|
+
minimum?: number;
|
|
584
|
+
/**
|
|
585
|
+
* Exclusive lower bound for numeric values.
|
|
586
|
+
*/
|
|
587
|
+
exclusiveMinimum?: number;
|
|
588
|
+
/**
|
|
589
|
+
* Inclusive upper bound for numeric values.
|
|
590
|
+
*/
|
|
591
|
+
maximum?: number;
|
|
592
|
+
/**
|
|
593
|
+
* Exclusive upper bound for numeric values.
|
|
594
|
+
*/
|
|
595
|
+
exclusiveMaximum?: number;
|
|
596
|
+
/**
|
|
597
|
+
* Constraint requiring values to be divisible by this value.
|
|
598
|
+
*/
|
|
599
|
+
multipleOf?: number;
|
|
600
|
+
/**
|
|
601
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
602
|
+
*
|
|
603
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
604
|
+
*/
|
|
605
|
+
default?: number;
|
|
606
|
+
/**
|
|
607
|
+
* Fixed set of allowed numeric values.
|
|
608
|
+
*/
|
|
609
|
+
enum?: number[];
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Integer-only numeric schema.
|
|
613
|
+
*/
|
|
614
|
+
interface JsonSchemaInteger extends JsonSchemaNumber {
|
|
615
|
+
/**
|
|
616
|
+
* Declares that values must be integers.
|
|
617
|
+
*/
|
|
618
|
+
type: "integer";
|
|
619
|
+
/**
|
|
620
|
+
* Optional integer-specific format.
|
|
621
|
+
*/
|
|
622
|
+
format?: JsonSchemaIntegerFormat | string;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Floating-point numeric schema.
|
|
626
|
+
*/
|
|
627
|
+
interface JsonSchemaDecimal extends JsonSchemaNumber {
|
|
628
|
+
/**
|
|
629
|
+
* Declares that values are non-integer numbers.
|
|
630
|
+
*/
|
|
631
|
+
type: "number";
|
|
632
|
+
/**
|
|
633
|
+
* Optional floating-point format.
|
|
634
|
+
*/
|
|
635
|
+
format?: JsonSchemaDecimalFormat | string;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Object schema keywords.
|
|
639
|
+
*
|
|
640
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2
|
|
641
|
+
*/
|
|
642
|
+
interface JsonSchemaObject extends JsonSchemaKeywords {
|
|
643
|
+
/**
|
|
644
|
+
* The JSON Schema object type. This property is used to indicate that the schema represents an object, which is a collection of key-value pairs where the keys are strings and the values can be of any type defined by the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
645
|
+
*/
|
|
646
|
+
type: "object";
|
|
647
|
+
/**
|
|
648
|
+
* The declared object properties and their schemas. This property can be used to define the expected structure of an object, where each key represents a property name and the corresponding value is a schema that defines the expected type and constraints for that property. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
649
|
+
*
|
|
650
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.1
|
|
651
|
+
*/
|
|
652
|
+
properties?: Record<string, JsonSchema>;
|
|
653
|
+
/**
|
|
654
|
+
* The schemas for properties whose names match the given patterns.
|
|
655
|
+
*
|
|
656
|
+
* @remarks
|
|
657
|
+
* Each property name of this object **SHOULD** be a valid regular expression, according to the [ECMA-262 regular expression dialect](https://www.ecma-international.org/ecma-262/). Each property value of this object **MUST** be a valid JSON Schema.
|
|
658
|
+
*
|
|
659
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.2
|
|
660
|
+
*/
|
|
661
|
+
patternProperties?: Record<string, JsonSchema>;
|
|
662
|
+
/**
|
|
663
|
+
* The schema for properties not matched by {@link properties} or {@link patternProperties}. This property can be used to allow additional properties in the object that are not explicitly defined in the {@link properties} or {@link patternProperties} keywords. The value of this property can be a boolean, where `true` allows any additional properties and `false` disallows any additional properties, or it can be a schema that defines the expected structure of the additional properties. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
664
|
+
*
|
|
665
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.3
|
|
666
|
+
*/
|
|
667
|
+
additionalProperties?: boolean | JsonSchema;
|
|
668
|
+
/**
|
|
669
|
+
* A list of property names that are required for the object. This property can be used by validation libraries or other tools that support this feature to enforce the presence of certain properties in the data that the schema represents. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
670
|
+
*/
|
|
671
|
+
required?: string[];
|
|
672
|
+
/**
|
|
673
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
674
|
+
*
|
|
675
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
676
|
+
*/
|
|
677
|
+
default?: Record<string, unknown>;
|
|
678
|
+
/**
|
|
679
|
+
* The schema for properties that have not yet been evaluated by other object keywords. This property can be used to apply a schema to properties that are not explicitly defined in the {@link properties} or {@link patternProperties} keywords, and that have not been evaluated by any other object keywords such as {@link additionalProperties} or {@link dependencies}. The value of this property can be a boolean, where `true` allows any unevaluated properties and `false` disallows any unevaluated properties, or it can be a schema that defines the expected structure of the unevaluated properties. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
680
|
+
*/
|
|
681
|
+
unevaluatedProperties?: boolean | JsonSchema;
|
|
682
|
+
/**
|
|
683
|
+
* A map of property-specific dependency requirements.
|
|
684
|
+
*/
|
|
685
|
+
dependencies?: Record<string, string[] | JsonSchema>;
|
|
686
|
+
/**
|
|
687
|
+
* Properties that become required when the key property is present.
|
|
688
|
+
*/
|
|
689
|
+
dependentRequired?: Record<string, string[]>;
|
|
690
|
+
/**
|
|
691
|
+
* Subschemas that apply when the key property is present.
|
|
692
|
+
*
|
|
693
|
+
* @remarks
|
|
694
|
+
* If the object key is a property in the instance, the entire instance must validate against the subschema. Its use is dependent on the presence of the property.
|
|
695
|
+
*
|
|
696
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.2.4
|
|
697
|
+
*/
|
|
698
|
+
dependentSchemas?: Record<string, JsonSchema>;
|
|
699
|
+
/**
|
|
700
|
+
* The minimum number of own properties allowed.
|
|
701
|
+
*/
|
|
702
|
+
minProperties?: number;
|
|
703
|
+
/**
|
|
704
|
+
* The maximum number of own properties allowed.
|
|
705
|
+
*/
|
|
706
|
+
maxProperties?: number;
|
|
707
|
+
/**
|
|
708
|
+
* An optional array of property names that are considered primary keys for the object. This property can be used by validation libraries or other tools that support this feature to provide additional validation rules or constraints for the data that the schema represents. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
709
|
+
*/
|
|
710
|
+
primaryKey?: string[];
|
|
711
|
+
/**
|
|
712
|
+
* A name for the database schema associated with the data represented by this schema. This property can be used by documentation tools or other libraries that support this feature to provide additional context or information about the data model that the schema represents. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
713
|
+
*/
|
|
714
|
+
databaseSchema?: string;
|
|
715
|
+
}
|
|
716
|
+
interface JsonSchemaString extends JsonSchemaKeywords {
|
|
717
|
+
/**
|
|
718
|
+
* Declares that the instance must be a string.
|
|
719
|
+
*/
|
|
720
|
+
type: "string";
|
|
721
|
+
/**
|
|
722
|
+
* The minimum number of characters allowed in the string.
|
|
723
|
+
*/
|
|
724
|
+
minLength?: number;
|
|
725
|
+
/**
|
|
726
|
+
* The maximum number of characters allowed in the string.
|
|
727
|
+
*/
|
|
728
|
+
maxLength?: number;
|
|
729
|
+
/**
|
|
730
|
+
* A regular expression that matching strings must satisfy.
|
|
731
|
+
*/
|
|
732
|
+
pattern?: string;
|
|
733
|
+
/**
|
|
734
|
+
* A format for the schema, which can be used by validation libraries or other tools that support this feature to provide additional validation or formatting rules for the data that the schema represents. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
735
|
+
*
|
|
736
|
+
* @see https://ajv.js.org/packages/ajv-formats.html
|
|
737
|
+
*
|
|
738
|
+
* @remarks
|
|
739
|
+
* The `format` property is a string that specifies the format of the data that the schema represents. It can be used to indicate that a string should be validated as an email address, a date-time, a URI, or any other format supported by compatible validation libraries. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
740
|
+
*/
|
|
741
|
+
format?: JsonSchemaStringFormat | string;
|
|
742
|
+
/**
|
|
743
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
744
|
+
*
|
|
745
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
746
|
+
*/
|
|
747
|
+
default?: string;
|
|
748
|
+
/**
|
|
749
|
+
* Fixed set of allowed string values.
|
|
750
|
+
*/
|
|
751
|
+
enum?: string[];
|
|
752
|
+
/**
|
|
753
|
+
* A keyword used to specify the media type of the content that the schema represents. It can be used by validation libraries or other tools that support this feature to provide additional validation or processing rules for the data based on its media type. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
754
|
+
*
|
|
755
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.8
|
|
756
|
+
*/
|
|
757
|
+
contentMediaType?: string;
|
|
758
|
+
/**
|
|
759
|
+
* A keyword used to specify the content encoding of the data that the schema represents. It can be used by validation libraries or other tools that support this feature to provide additional validation or processing rules for the data based on its content encoding. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
760
|
+
*
|
|
761
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.8
|
|
762
|
+
*/
|
|
763
|
+
contentEncoding?: string;
|
|
764
|
+
/**
|
|
765
|
+
* A keyword used to specify a schema for the content that the schema represents. It can be used by validation libraries or other tools that support this feature to provide additional validation or processing rules for the data based on its schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
766
|
+
*
|
|
767
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.9
|
|
768
|
+
*/
|
|
769
|
+
contentSchema?: string;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Set-like array schema that enforces item uniqueness.
|
|
773
|
+
*/
|
|
774
|
+
interface JsonSchemaSet extends JsonSchemaKeywords {
|
|
775
|
+
/**
|
|
776
|
+
* Declares that set values are serialized as arrays.
|
|
777
|
+
*/
|
|
778
|
+
type: "array";
|
|
779
|
+
/**
|
|
780
|
+
* Enforces set semantics by requiring distinct elements.
|
|
781
|
+
*/
|
|
782
|
+
uniqueItems: true;
|
|
783
|
+
/**
|
|
784
|
+
* Schemas for positional items at each tuple index.
|
|
785
|
+
*/
|
|
786
|
+
prefixItems?: JsonSchema[];
|
|
787
|
+
/**
|
|
788
|
+
* Schema for remaining items.
|
|
789
|
+
*/
|
|
790
|
+
items?: JsonSchema;
|
|
791
|
+
/**
|
|
792
|
+
* Subschema that at least one item must satisfy.
|
|
793
|
+
*/
|
|
794
|
+
contains?: JsonSchema;
|
|
795
|
+
/**
|
|
796
|
+
* Minimum number of items allowed.
|
|
797
|
+
*/
|
|
798
|
+
minItems?: number;
|
|
799
|
+
/**
|
|
800
|
+
* Maximum number of items allowed.
|
|
801
|
+
*/
|
|
802
|
+
maxItems?: number;
|
|
803
|
+
/**
|
|
804
|
+
* Minimum number of items that must satisfy {@link JsonSchemaSet.contains | contains}.
|
|
805
|
+
*/
|
|
806
|
+
minContains?: number;
|
|
807
|
+
/**
|
|
808
|
+
* Maximum number of items that may satisfy {@link JsonSchemaSet.contains | contains}.
|
|
809
|
+
*/
|
|
810
|
+
maxContains?: number;
|
|
811
|
+
/**
|
|
812
|
+
* Controls validation for items not otherwise evaluated.
|
|
813
|
+
*/
|
|
814
|
+
unevaluatedItems?: boolean | JsonSchema;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Schema used to validate record keys.
|
|
818
|
+
*/
|
|
819
|
+
type JsonSchemaRecordPropertyNames = JsonSchema;
|
|
820
|
+
/**
|
|
821
|
+
* Record/object schema with key constraints.
|
|
822
|
+
*/
|
|
823
|
+
interface JsonSchemaRecord extends JsonSchemaKeywords {
|
|
824
|
+
/**
|
|
825
|
+
* Declares that the instance must be an object.
|
|
826
|
+
*/
|
|
827
|
+
type: "object";
|
|
828
|
+
/**
|
|
829
|
+
* The schemas for properties whose names match the given patterns.
|
|
830
|
+
*
|
|
831
|
+
* @remarks
|
|
832
|
+
* Each property name of this object **SHOULD** be a valid regular expression, according to the [ECMA-262 regular expression dialect](https://www.ecma-international.org/ecma-262/). Each property value of this object **MUST** be a valid JSON Schema.
|
|
833
|
+
*
|
|
834
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.2
|
|
835
|
+
*/
|
|
836
|
+
patternProperties?: Record<string, JsonSchema>;
|
|
837
|
+
/**
|
|
838
|
+
* The schema for properties not matched by {@link properties} or {@link patternProperties}. This property can be used to allow additional properties in the object that are not explicitly defined in the `properties` or `patternProperties` keywords. The value of this property can be a boolean, where `true` allows any additional properties and `false` disallows any additional properties, or it can be a schema that defines the expected structure of the additional properties. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
839
|
+
*
|
|
840
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.3
|
|
841
|
+
*/
|
|
842
|
+
additionalProperties?: boolean | JsonSchema;
|
|
843
|
+
/**
|
|
844
|
+
* The schema that each property name must satisfy.
|
|
845
|
+
*/
|
|
846
|
+
propertyNames?: JsonSchemaRecordPropertyNames;
|
|
847
|
+
/**
|
|
848
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
849
|
+
*
|
|
850
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
851
|
+
*/
|
|
852
|
+
default?: Record<string, unknown>;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Tuple schema modeled with positional {@link JsonSchemaTuple.prefixItems | prefixItems} plus optional trailing {@link JsonSchemaTuple.items | items}.
|
|
856
|
+
*/
|
|
857
|
+
type JsonSchemaTuple = JsonSchemaKeywords & {
|
|
858
|
+
/**
|
|
859
|
+
* Declares that tuple values are represented as arrays.
|
|
860
|
+
*/
|
|
861
|
+
type: "array";
|
|
862
|
+
/**
|
|
863
|
+
* Minimum number of elements required.
|
|
864
|
+
*/
|
|
865
|
+
minItems?: number;
|
|
866
|
+
/**
|
|
867
|
+
* Maximum number of elements allowed.
|
|
868
|
+
*/
|
|
869
|
+
maxItems?: number;
|
|
870
|
+
/**
|
|
871
|
+
* Positional schemas for tuple elements.
|
|
872
|
+
*/
|
|
873
|
+
prefixItems: JsonSchema[];
|
|
874
|
+
/**
|
|
875
|
+
* The schema applied to items beyond {@link prefixItems}. In draft 2020-12,
|
|
876
|
+
* tuple positions are modeled with {@link prefixItems}, while {@link items}
|
|
877
|
+
* applies to the remaining elements.
|
|
878
|
+
*
|
|
879
|
+
* @remarks
|
|
880
|
+
* The behavior of {@link items} without {@link prefixItems} is identical to that of the schema form of {@link items} in drafts prior to 2020-12. When {@link prefixItems} is present, the behavior of {@link items} is identical to the former {@link additionalItems} keyword.
|
|
881
|
+
*
|
|
882
|
+
* @see https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1.2
|
|
883
|
+
*/
|
|
884
|
+
items?: JsonSchema;
|
|
885
|
+
/**
|
|
886
|
+
* Subschema that at least one tuple element must satisfy.
|
|
887
|
+
*/
|
|
888
|
+
contains?: JsonSchema;
|
|
889
|
+
/**
|
|
890
|
+
* Whether tuple elements must be unique.
|
|
891
|
+
*/
|
|
892
|
+
uniqueItems?: boolean;
|
|
893
|
+
/**
|
|
894
|
+
* Minimum number of elements that must satisfy {@link JsonSchemaTuple.contains | contains}.
|
|
895
|
+
*/
|
|
896
|
+
minContains?: number;
|
|
897
|
+
/**
|
|
898
|
+
* Maximum number of elements that may satisfy {@link JsonSchemaTuple.contains | contains}.
|
|
899
|
+
*/
|
|
900
|
+
maxContains?: number;
|
|
901
|
+
/**
|
|
902
|
+
* Controls validation of unevaluated tuple elements.
|
|
903
|
+
*/
|
|
904
|
+
unevaluatedItems?: boolean | JsonSchema;
|
|
905
|
+
};
|
|
906
|
+
/**
|
|
907
|
+
* Schema used to represent undefined-like semantics through negation.
|
|
908
|
+
*/
|
|
909
|
+
interface JsonSchemaUndefined extends JsonSchemaKeywords {
|
|
910
|
+
/**
|
|
911
|
+
* Negated schema marker used to represent undefined-like semantics.
|
|
912
|
+
*/
|
|
913
|
+
not: JsonSchemaAny;
|
|
914
|
+
/**
|
|
915
|
+
* A keyword that is used to specify a default value for a property in a JSON Schema. It provides a default value that can be used when an instance does not provide a value for that property.
|
|
916
|
+
*
|
|
917
|
+
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-10.2
|
|
918
|
+
*/
|
|
919
|
+
default?: undefined;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Union schema represented as either primitive type unions or `anyOf` compositions.
|
|
923
|
+
*/
|
|
924
|
+
type JsonSchemaUnion = JsonSchemaKeywords & (JsonSchemaPrimitiveUnion | JsonSchemaAnyOf);
|
|
925
|
+
/**
|
|
926
|
+
* Union of primitive type combinations and enum-backed primitive unions.
|
|
927
|
+
*/
|
|
928
|
+
type JsonSchemaPrimitiveUnion = JsonSchemaKeywords & ({
|
|
929
|
+
/**
|
|
930
|
+
* Primitive `type` or list of primitive types accepted by the union.
|
|
931
|
+
*/
|
|
932
|
+
type: JsonSchemaPrimitiveType | JsonSchemaPrimitiveType[];
|
|
933
|
+
} | {
|
|
934
|
+
/**
|
|
935
|
+
* Enum values that may be of different primitive types.
|
|
936
|
+
*/
|
|
937
|
+
enum: (string | number | bigint | boolean | null)[];
|
|
938
|
+
});
|
|
939
|
+
/**
|
|
940
|
+
* Permissive schema alias for unknown values.
|
|
941
|
+
*/
|
|
942
|
+
type JsonSchemaUnknown = JsonSchemaKeywords & JsonSchemaAny;
|
|
943
|
+
/**
|
|
944
|
+
* `anyOf` composition schema.
|
|
945
|
+
*/
|
|
946
|
+
interface JsonSchemaAnyOf extends JsonSchemaKeywords {
|
|
947
|
+
/**
|
|
948
|
+
* Subschemas where at least one must validate.
|
|
949
|
+
*/
|
|
950
|
+
anyOf: JsonSchema[];
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* A reference schema that resolves through a URI.
|
|
954
|
+
*/
|
|
955
|
+
interface JsonSchemaRef extends JsonSchemaKeywords {
|
|
956
|
+
/**
|
|
957
|
+
* URI reference to a schema definition.
|
|
958
|
+
*/
|
|
959
|
+
$ref: string;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* JSON Schema (draft 2020-12) type that can be used to validate JSON data. It is a union of all the specific JSON Schema types, as well as the metadata properties that can be included in any JSON Schema.
|
|
963
|
+
*
|
|
964
|
+
* @see https://json-schema.org/draft/2020-12
|
|
965
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
966
|
+
*/
|
|
967
|
+
type JsonSchema = JsonSchemaString | JsonSchemaInteger | JsonSchemaDecimal | JsonSchemaBigint | JsonSchemaBoolean | JsonSchemaDate | JsonSchemaEnum | JsonSchemaLiteral | JsonSchemaNativeEnum | JsonSchemaNull | JsonSchemaArray | JsonSchemaObject | JsonSchemaRecord | JsonSchemaTuple | JsonSchemaUnion | JsonSchemaUndefined | JsonSchemaRef | JsonSchemaNever | JsonSchemaMap | JsonSchemaAny | JsonSchemaNullable | JsonSchemaAllOf | JsonSchemaUnknown | JsonSchemaSet;
|
|
968
|
+
/**
|
|
969
|
+
* An object containing common JSON Schema metadata properties that can be included in any schema type. This interface is used to define the shared metadata properties that can be present in all JSON Schema types, such as `$id`, `$schema`, `title`, `description`, and others. It serves as a base for all specific JSON Schema types, allowing them to include these common metadata properties without having to redefine them in each type.
|
|
970
|
+
*/
|
|
971
|
+
interface JsonSchemaLike extends JsonSchemaKeywords {
|
|
972
|
+
$id?: string;
|
|
973
|
+
$schema?: string;
|
|
974
|
+
$vocabulary?: Record<string, boolean>;
|
|
975
|
+
$comment?: string;
|
|
976
|
+
$anchor?: string;
|
|
977
|
+
$defs?: Record<string, JsonSchema>;
|
|
978
|
+
$dynamicRef?: string;
|
|
979
|
+
$dynamicAnchor?: string;
|
|
980
|
+
$ref?: string;
|
|
981
|
+
name?: string;
|
|
982
|
+
title?: string;
|
|
983
|
+
description?: string;
|
|
984
|
+
docs?: string;
|
|
985
|
+
examples?: unknown[];
|
|
986
|
+
alias?: string[];
|
|
987
|
+
tags?: string[];
|
|
988
|
+
deprecated?: boolean | string | {
|
|
989
|
+
message?: string;
|
|
990
|
+
since?: string;
|
|
991
|
+
alternative?: string;
|
|
992
|
+
};
|
|
993
|
+
hidden?: boolean;
|
|
994
|
+
ignore?: boolean;
|
|
995
|
+
internal?: boolean;
|
|
996
|
+
runtime?: boolean;
|
|
997
|
+
readOnly?: boolean;
|
|
998
|
+
writeOnly?: boolean;
|
|
999
|
+
type?: JsonSchemaType | JsonSchemaType[] | JsonSchemaPrimitiveType | JsonSchemaPrimitiveType[] | [Exclude<JsonSchemaType, "null">, "null"] | ["null", Exclude<JsonSchemaType, "null">];
|
|
1000
|
+
const?: unknown;
|
|
1001
|
+
enum?: (string | number | bigint | boolean | null)[];
|
|
1002
|
+
format?: string;
|
|
1003
|
+
default?: unknown;
|
|
1004
|
+
allOf?: JsonSchema[];
|
|
1005
|
+
anyOf?: JsonSchema[] | [JsonSchema, JsonSchemaNull];
|
|
1006
|
+
oneOf?: JsonSchema[];
|
|
1007
|
+
not?: JsonSchema;
|
|
1008
|
+
if?: JsonSchema;
|
|
1009
|
+
then?: JsonSchema;
|
|
1010
|
+
else?: JsonSchema;
|
|
1011
|
+
properties?: Record<string, JsonSchema>;
|
|
1012
|
+
patternProperties?: Record<string, JsonSchema>;
|
|
1013
|
+
additionalProperties?: boolean | JsonSchema;
|
|
1014
|
+
required?: string[];
|
|
1015
|
+
propertyNames?: JsonSchemaRecordPropertyNames;
|
|
1016
|
+
dependencies?: Record<string, string[] | JsonSchema>;
|
|
1017
|
+
dependentRequired?: Record<string, string[]>;
|
|
1018
|
+
dependentSchemas?: Record<string, JsonSchema>;
|
|
1019
|
+
minProperties?: number;
|
|
1020
|
+
maxProperties?: number;
|
|
1021
|
+
primaryKey?: string[];
|
|
1022
|
+
databaseSchema?: string;
|
|
1023
|
+
unevaluatedProperties?: boolean | JsonSchema;
|
|
1024
|
+
prefixItems?: JsonSchema[];
|
|
1025
|
+
items?: JsonSchema | JsonSchemaMap["items"];
|
|
1026
|
+
contains?: JsonSchema;
|
|
1027
|
+
minItems?: number;
|
|
1028
|
+
maxItems?: number;
|
|
1029
|
+
uniqueItems?: boolean;
|
|
1030
|
+
minContains?: number;
|
|
1031
|
+
maxContains?: number;
|
|
1032
|
+
unevaluatedItems?: boolean | JsonSchema;
|
|
1033
|
+
minLength?: number;
|
|
1034
|
+
maxLength?: number;
|
|
1035
|
+
pattern?: string;
|
|
1036
|
+
contentMediaType?: string;
|
|
1037
|
+
contentEncoding?: string;
|
|
1038
|
+
contentSchema?: string;
|
|
1039
|
+
minimum?: number | bigint;
|
|
1040
|
+
exclusiveMinimum?: number | bigint;
|
|
1041
|
+
maximum?: number | bigint;
|
|
1042
|
+
exclusiveMaximum?: number | bigint;
|
|
1043
|
+
multipleOf?: number | bigint;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Supported source variants from which a schema can be extracted.
|
|
1047
|
+
*/
|
|
1048
|
+
type SchemaSourceVariant = "standard-schema" | "json-schema" | "zod3" | "untyped" | "valibot" | "reflection";
|
|
1049
|
+
/**
|
|
1050
|
+
* Accepted schema input variants, including raw type definitions.
|
|
1051
|
+
*/
|
|
1052
|
+
type SchemaInputVariant = SchemaSourceVariant | "file-reference";
|
|
1053
|
+
/**
|
|
1054
|
+
* Raw schema source input union before normalization.
|
|
1055
|
+
*/
|
|
1056
|
+
type SchemaSourceInput = StandardJSONSchemaV1 | JsonSchema | z3.ZodTypeAny | UntypedInputObject | UntypedSchema | ValibotSchema | Type;
|
|
1057
|
+
/**
|
|
1058
|
+
* Any accepted schema input, including normalized schemas and references.
|
|
1059
|
+
*/
|
|
1060
|
+
type SchemaInput = SchemaSourceInput | Schema$1 | FileReferenceInput;
|
|
1061
|
+
/**
|
|
1062
|
+
* A schema extracted from a source input, normalized to JSON Schema.
|
|
1063
|
+
*/
|
|
1064
|
+
interface Schema$1<TJsonSchema extends JsonSchema = JsonSchema> {
|
|
1065
|
+
/** A stable content hash for the normalized schema. */
|
|
1066
|
+
hash: string;
|
|
1067
|
+
/** The source variant used to derive the normalized {@link JsonSchema}. */
|
|
1068
|
+
variant: SchemaInputVariant;
|
|
1069
|
+
/** The normalized schema definition. */
|
|
1070
|
+
schema: TJsonSchema;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Base metadata captured for schema source inputs.
|
|
1074
|
+
*/
|
|
1075
|
+
interface BaseSchemaSource {
|
|
1076
|
+
/** A stable content hash for the original source schema. */
|
|
1077
|
+
hash: string;
|
|
1078
|
+
/** The specific source format used for the schema input. */
|
|
1079
|
+
variant: SchemaSourceVariant;
|
|
1080
|
+
/** The original schema input captured before normalization. */
|
|
1081
|
+
schema: SchemaSourceInput;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Source descriptor for schemas that already use JSON Schema.
|
|
1085
|
+
*/
|
|
1086
|
+
interface JsonSchemaSchemaSource extends BaseSchemaSource {
|
|
1087
|
+
/** Indicates the source input already uses JSON Schema syntax. */
|
|
1088
|
+
variant: "json-schema";
|
|
1089
|
+
/** The original JSON Schema document. */
|
|
1090
|
+
schema: JsonSchema;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Source descriptor for Standard Schema inputs.
|
|
1094
|
+
*/
|
|
1095
|
+
interface StandardSchemaSchemaSource extends BaseSchemaSource {
|
|
1096
|
+
/** Indicates the source input follows the Standard Schema format. */
|
|
1097
|
+
variant: "standard-schema";
|
|
1098
|
+
/** The original Standard Schema document. */
|
|
1099
|
+
schema: StandardJSONSchemaV1;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Source descriptor for Zod v3 schema inputs.
|
|
1103
|
+
*/
|
|
1104
|
+
interface Zod3SchemaSource extends BaseSchemaSource {
|
|
1105
|
+
/** Indicates the source input is a Zod v3 schema. */
|
|
1106
|
+
variant: "zod3";
|
|
1107
|
+
/** The original Zod v3 schema instance. */
|
|
1108
|
+
schema: z3.ZodTypeAny;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Source descriptor for Deepkit reflection type inputs.
|
|
1112
|
+
*/
|
|
1113
|
+
interface ReflectionSchemaSource extends BaseSchemaSource {
|
|
1114
|
+
/** Indicates the source input is a Deepkit reflection {@link Type}. */
|
|
1115
|
+
variant: "reflection";
|
|
1116
|
+
/** The original Deepkit reflection type. */
|
|
1117
|
+
schema: Type;
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Source descriptor for Untyped schema inputs.
|
|
1121
|
+
*/
|
|
1122
|
+
interface UntypedSchemaSource extends BaseSchemaSource {
|
|
1123
|
+
/** Indicates the source input comes from the Untyped schema model. */
|
|
1124
|
+
variant: "untyped";
|
|
1125
|
+
/** The original Untyped schema input. */
|
|
1126
|
+
schema: UntypedInputObject | UntypedSchema;
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Source descriptor for Valibot schema inputs.
|
|
1130
|
+
*/
|
|
1131
|
+
interface ValibotSchemaSource extends BaseSchemaSource {
|
|
1132
|
+
/** Indicates the source input comes from the Valibot schema model. */
|
|
1133
|
+
variant: "valibot";
|
|
1134
|
+
/** The original Valibot schema input. */
|
|
1135
|
+
schema: ValibotSchema;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Union of all normalized schema source descriptor variants.
|
|
1139
|
+
*/
|
|
1140
|
+
type SchemaSource = JsonSchemaSchemaSource | StandardSchemaSchemaSource | Zod3SchemaSource | UntypedSchemaSource | ValibotSchemaSource | ReflectionSchemaSource;
|
|
1141
|
+
/**
|
|
1142
|
+
* A normalized schema plus metadata about the source that produced it.
|
|
1143
|
+
*/
|
|
1144
|
+
interface ExtractedSchema extends Schema$1 {
|
|
1145
|
+
/**
|
|
1146
|
+
* The schema source that produced this normalized schema.
|
|
1147
|
+
*/
|
|
1148
|
+
source: SchemaSource;
|
|
1149
|
+
}
|
|
1150
|
+
//#endregion
|
|
1151
|
+
export { BaseSchemaSource, ExtractedSchema, JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBigint, JsonSchemaBoolean, JsonSchemaConditionalKeywords, JsonSchemaDate, JsonSchemaDecimal, JsonSchemaDecimalFormat, JsonSchemaEnum, JsonSchemaInteger, JsonSchemaIntegerFormat, JsonSchemaKeywords, JsonSchemaLike, JsonSchemaLiteral, JsonSchemaLogicKeywords, JsonSchemaMap, JsonSchemaMetadataKeywords, JsonSchemaNativeEnum, JsonSchemaNever, JsonSchemaNull, JsonSchemaNullable, JsonSchemaNumber, JsonSchemaNumberFormat, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaPrimitiveUnion, JsonSchemaRecord, JsonSchemaRecordPropertyNames, JsonSchemaRef, JsonSchemaSchemaSource, JsonSchemaSet, JsonSchemaString, JsonSchemaStringFormat, JsonSchemaTuple, JsonSchemaType, JsonSchemaUndefined, JsonSchemaUnion, JsonSchemaUnknown, ReflectionSchemaSource, Schema$1 as Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant, StandardSchemaSchemaSource, UntypedInputObject, UntypedSchema, UntypedSchemaSource, ValibotSchema, ValibotSchemaSource, Zod3SchemaSource };
|
|
1152
|
+
//# sourceMappingURL=types.d.cts.map
|