@forklaunch/validator 0.4.11 → 0.5.0
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/lib/__test__/utils/mockSchemaValidator.d.mts +111 -3
- package/lib/__test__/utils/mockSchemaValidator.d.ts +111 -3
- package/lib/__test__/utils/mockSchemaValidator.js +105 -0
- package/lib/__test__/utils/mockSchemaValidator.mjs +102 -0
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/{schema.types-BA3PeCI5.d.mts → schema.types-BL6n8u4w.d.mts} +228 -19
- package/lib/{schema.types-BA3PeCI5.d.ts → schema.types-BL6n8u4w.d.ts} +228 -19
- package/lib/src/typebox/index.d.mts +31 -122
- package/lib/src/typebox/index.d.ts +31 -122
- package/lib/src/typebox/index.js +70 -14
- package/lib/src/typebox/index.mjs +63 -13
- package/lib/src/zod/index.d.mts +28 -4
- package/lib/src/zod/index.d.ts +28 -4
- package/lib/src/zod/index.js +65 -23
- package/lib/src/zod/index.mjs +60 -24
- package/package.json +2 -2
|
@@ -1,8 +1,144 @@
|
|
|
1
1
|
import { Prettify } from '@forklaunch/common';
|
|
2
2
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
3
|
-
import
|
|
3
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
|
+
import { TProperties, TOptional, TArray, TUnion, TLiteral, TFunction, TRecord, TPromise, TSchema, TUnknown, TKind, TObject as TObject$1, TNever, StaticDecode } from '@sinclair/typebox';
|
|
4
5
|
import { TypeCheck } from '@sinclair/typebox/compiler';
|
|
5
|
-
import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodType, z, ZodUnknown, ZodNever, ZodTypeAny } from 'zod';
|
|
6
|
+
import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodFunction, ZodTuple, ZodRecord, ZodPromise, ZodType, z, ZodUnknown, ZodNever, ZodTypeAny } from 'zod';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Class representing a TypeBox schema definition.
|
|
10
|
+
* @implements {SchemaValidator}
|
|
11
|
+
*/
|
|
12
|
+
declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObject<TProperties>>(schema: T) => TypeCheck<T>), <T extends TIdiomaticSchema>(schema: T) => TResolve<T>, <T extends TIdiomaticSchema>(schema: T) => TOptional<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => TArray<TResolve<T>>, <T extends TUnionTupleContainer>(schemas: [...T]) => TUnion<UnionTupleTResolve<T>>, <T extends LiteralSchema>(value: T) => TLiteral<T>, <T extends Record<string, LiteralSchema>>(schemaEnum: T) => TUnion<[
|
|
13
|
+
{
|
|
14
|
+
[K in keyof T]: TLiteral<T[K]>;
|
|
15
|
+
}[keyof T]
|
|
16
|
+
]>, <Args extends TUnionTupleContainer, ReturnType extends TIdiomaticSchema>(args: [...Args], returnType: ReturnType) => TFunction<UnionTupleTResolve<Args>, TResolve<ReturnType>>, <Key extends TIdiomaticSchema, Value extends TIdiomaticSchema>(key: Key, value: Value) => TRecord<TResolve<Key>, TResolve<Value>>, <T extends TIdiomaticSchema>(schema: T) => TPromise<TResolve<T>>, (value: unknown) => value is TSchema, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => boolean, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => ParseResult<TResolve<T>>, <T extends TIdiomaticSchema | TCatchall>(schema: T) => SchemaObject> {
|
|
17
|
+
_Type: "TypeBox";
|
|
18
|
+
_SchemaCatchall: TCatchall;
|
|
19
|
+
_ValidSchemaObject: TObject<TProperties> | TArray<TObject<TProperties>>;
|
|
20
|
+
string: _sinclair_typebox.TString;
|
|
21
|
+
uuid: _sinclair_typebox.TString;
|
|
22
|
+
uri: _sinclair_typebox.TString;
|
|
23
|
+
email: _sinclair_typebox.TString;
|
|
24
|
+
number: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TDate, _sinclair_typebox.TBigInt]>, number>;
|
|
25
|
+
bigint: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TBigInt, _sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TDate]>, bigint>;
|
|
26
|
+
boolean: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TString]>, boolean>;
|
|
27
|
+
date: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TDate, _sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>, Date>;
|
|
28
|
+
symbol: _sinclair_typebox.TSymbol;
|
|
29
|
+
nullish: TUnion<[_sinclair_typebox.TVoid, _sinclair_typebox.TNull, _sinclair_typebox.TUndefined]>;
|
|
30
|
+
void: _sinclair_typebox.TVoid;
|
|
31
|
+
null: _sinclair_typebox.TNull;
|
|
32
|
+
undefined: _sinclair_typebox.TUndefined;
|
|
33
|
+
any: _sinclair_typebox.TAny;
|
|
34
|
+
unknown: _sinclair_typebox.TUnknown;
|
|
35
|
+
never: _sinclair_typebox.TNever;
|
|
36
|
+
/**
|
|
37
|
+
* Extracts the error type of a schema for error messages.
|
|
38
|
+
*
|
|
39
|
+
* @param {TCatchall} schema - A schema that contains some type information.
|
|
40
|
+
* @returns The type of the schema for error messages.
|
|
41
|
+
*/
|
|
42
|
+
private errorType;
|
|
43
|
+
/**
|
|
44
|
+
* Compiles schema if this exists, for optimal performance.
|
|
45
|
+
*
|
|
46
|
+
* @param {TObject<TProperties>} schema - The schema to compile.
|
|
47
|
+
* @returns {TypeCheck<T>} - The compiled schema.
|
|
48
|
+
*/
|
|
49
|
+
compile<T extends TObject<TProperties>>(schema: T): TypeCheck<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Convert a schema to a TypeBox schema.
|
|
52
|
+
* @param {TIdiomaticSchema} schema - The schema to convert.
|
|
53
|
+
* @returns {TResolve<T>} The resolved schema.
|
|
54
|
+
*/
|
|
55
|
+
schemify<T extends TIdiomaticSchema>(schema: T): TResolve<T>;
|
|
56
|
+
/**
|
|
57
|
+
* Make a schema optional.
|
|
58
|
+
* @param {TIdiomaticSchema} schema - The schema to make optional.
|
|
59
|
+
* @returns {TOptional<TResolve<T>>} The optional schema.
|
|
60
|
+
*/
|
|
61
|
+
optional<T extends TIdiomaticSchema>(schema: T): TOptional<TResolve<T>>;
|
|
62
|
+
/**
|
|
63
|
+
* Create an array schema.
|
|
64
|
+
* @param {TIdiomaticSchema} schema - The schema to use for array items.
|
|
65
|
+
* @returns {TArray<TResolve<T>>} The array schema.
|
|
66
|
+
*/
|
|
67
|
+
array<T extends TIdiomaticSchema>(schema: T): TArray<TResolve<T>>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a union schema.
|
|
70
|
+
* @param {TUnionTupleContainer} schemas - The schemas to union.
|
|
71
|
+
* @returns {TUnion<UnionTupleTResolve<T>>} The union schema.
|
|
72
|
+
*
|
|
73
|
+
* WARNING: If "nullish" or TUndefined is included in the union, the key will still be expected.
|
|
74
|
+
* This is a limitation of TypeBox. Consider using "optional" instead.
|
|
75
|
+
*/
|
|
76
|
+
union<T extends TUnionTupleContainer>(schemas: [...T]): TUnion<UnionTupleTResolve<T>>;
|
|
77
|
+
/**
|
|
78
|
+
* Create a literal schema.
|
|
79
|
+
* @param {LiteralSchema} value - The literal value.
|
|
80
|
+
* @returns {TLiteral<T>} The literal schema.
|
|
81
|
+
*/
|
|
82
|
+
literal<T extends LiteralSchema>(value: T): TLiteral<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Create an enum schema.
|
|
85
|
+
* @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
|
|
86
|
+
* @returns {TUnion<UnionTupleTResolve<T[]>>} The enum schema.
|
|
87
|
+
*/
|
|
88
|
+
enum_<T extends Record<string, LiteralSchema>>(schemaEnum: T): TUnion<[
|
|
89
|
+
{
|
|
90
|
+
[K in keyof T]: TLiteral<T[K]>;
|
|
91
|
+
}[keyof T]
|
|
92
|
+
]>;
|
|
93
|
+
/**
|
|
94
|
+
* Create a function schema.
|
|
95
|
+
* @param {TSchema[]} args - The arguments of the function.
|
|
96
|
+
* @param {TAny} returnType - The return type of the function.
|
|
97
|
+
* @returns {TFunction<Args, ReturnType>} The function schema.
|
|
98
|
+
*/
|
|
99
|
+
function_<Args extends TUnionTupleContainer, ReturnType extends TIdiomaticSchema>(args: [...Args], returnType: ReturnType): TFunction<UnionTupleTResolve<Args>, TResolve<ReturnType>>;
|
|
100
|
+
/**
|
|
101
|
+
* Create a record schema.
|
|
102
|
+
* @param {TIdiomaticSchema} key - The key schema.
|
|
103
|
+
* @param {TIdiomaticSchema} value - The value schema.
|
|
104
|
+
* @returns {TRecord<TResolve<Key>, TResolve<Value>>} The record schema.
|
|
105
|
+
*/
|
|
106
|
+
record<Key extends TIdiomaticSchema, Value extends TIdiomaticSchema>(key: Key, value: Value): TRecord<TResolve<Key>, TResolve<Value>>;
|
|
107
|
+
/**
|
|
108
|
+
* Create a promise schema.
|
|
109
|
+
* @param {TIdiomaticSchema} schema - The schema to use for the promise.
|
|
110
|
+
* @returns {TPromise<TResolve<T>>} The promise schema.
|
|
111
|
+
*/
|
|
112
|
+
promise<T extends TIdiomaticSchema>(schema: T): TPromise<TResolve<T>>;
|
|
113
|
+
/**
|
|
114
|
+
* Check if a value is a TypeBox object schema.
|
|
115
|
+
* @param {unknown} value - The value to check.
|
|
116
|
+
* @returns {boolean} True if the value is a TypeBox object schema.
|
|
117
|
+
*/
|
|
118
|
+
isSchema(value: unknown): value is TSchema;
|
|
119
|
+
/**
|
|
120
|
+
* Validate a value against a schema.
|
|
121
|
+
*
|
|
122
|
+
* @param {TSchema} schema - The schema to validate against.
|
|
123
|
+
* @param {unknown} value - The value to validate.
|
|
124
|
+
* @returns {boolean} True if valid, otherwise false.
|
|
125
|
+
*/
|
|
126
|
+
validate<T extends TIdiomaticSchema | TCatchall>(schema: T | TypeCheck<TResolve<T>>, value: unknown): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Parse a value against a schema.
|
|
129
|
+
*
|
|
130
|
+
* @param {TSchema} schema - The schema to validate against.
|
|
131
|
+
* @param {unknown} value - The value to validate.
|
|
132
|
+
* @returns {ParseResult<TResolve<T>>} The parsing result.
|
|
133
|
+
*/
|
|
134
|
+
parse<T extends TIdiomaticSchema | TCatchall>(schema: T | TypeCheck<TResolve<T>>, value: unknown): ParseResult<TResolve<T>>;
|
|
135
|
+
/**
|
|
136
|
+
* Convert a schema to an OpenAPI schema object.
|
|
137
|
+
* @param {TIdiomaticSchema | TCatchall} schema - The schema to convert.
|
|
138
|
+
* @returns {SchemaObject} The OpenAPI schema object.
|
|
139
|
+
*/
|
|
140
|
+
openapi<T extends TIdiomaticSchema | TCatchall>(schema: T): SchemaObject;
|
|
141
|
+
}
|
|
6
142
|
|
|
7
143
|
/**
|
|
8
144
|
* Represents a catch-all schema type.
|
|
@@ -29,7 +165,7 @@ type TObject<T> = T extends TObjectShape ? TObject$1<T> : TNever;
|
|
|
29
165
|
*
|
|
30
166
|
* @template T - The schema type to translate.
|
|
31
167
|
*/
|
|
32
|
-
type TSchemaTranslate<T> = T extends
|
|
168
|
+
type TSchemaTranslate<T> = T extends TSchema ? StaticDecode<T> : TNever;
|
|
33
169
|
/**
|
|
34
170
|
* Represents an unboxed object schema where each key can have an idiomatic schema.
|
|
35
171
|
*/
|
|
@@ -39,26 +175,29 @@ type UnboxedTObjectSchema = {
|
|
|
39
175
|
/**
|
|
40
176
|
* Represents an idiomatic schema which can be an unboxed object schema or a literal schema.
|
|
41
177
|
*/
|
|
42
|
-
type TIdiomaticSchema =
|
|
178
|
+
type TIdiomaticSchema = IdiomaticSchema<TypeboxSchemaValidator>;
|
|
43
179
|
/**
|
|
44
180
|
* Represents a container for a union of idiomatic schemas.
|
|
45
181
|
*/
|
|
46
|
-
type
|
|
182
|
+
type TUnionTupleContainer = [...TIdiomaticSchema[]];
|
|
47
183
|
/**
|
|
48
184
|
* Resolves a union container to a tuple of resolved idiomatic schemas.
|
|
49
185
|
*
|
|
50
186
|
* @template T - The union container to resolve.
|
|
51
187
|
*/
|
|
52
|
-
type
|
|
188
|
+
type UnionTupleTResolve<T extends TUnionTupleContainer, Acc extends TIdiomaticSchema[] = []> = T extends [
|
|
189
|
+
infer Head extends TIdiomaticSchema,
|
|
190
|
+
...infer Tail extends TUnionTupleContainer
|
|
191
|
+
] ? UnionTupleTResolve<Tail, [...Acc, TResolve<Head>]> : T extends [] ? Acc : TNever[];
|
|
53
192
|
/**
|
|
54
193
|
* Resolves a schema type T to its resolved type. The depth is limited to 12 to prevent infinite recursion, due to StaticDecode limitations.
|
|
55
194
|
*
|
|
56
195
|
* @template T - The schema type to resolve.
|
|
57
196
|
* @template Depth - The current depth of the resolution.
|
|
58
197
|
*/
|
|
59
|
-
type TResolve<T, Depth extends number = 0> = Depth extends
|
|
198
|
+
type TResolve<T, Depth extends number = 0> = Depth extends 12 ? TUnknown : T extends LiteralSchema ? TLiteral<T> : T extends TSchema ? T : T extends TKind ? T : T extends UnboxedTObjectSchema ? TObject<{
|
|
60
199
|
[K in keyof T]: TResolve<T[K], Increment<Depth>>;
|
|
61
|
-
}> : TNever;
|
|
200
|
+
}> extends infer R ? R : TNever : T extends TypeCheck<infer Type> ? TResolve<Type, Increment<Depth>> : TNever;
|
|
62
201
|
|
|
63
202
|
/**
|
|
64
203
|
* This module provides a Zod-based schema definition.
|
|
@@ -71,11 +210,11 @@ type TResolve<T, Depth extends number = 0> = Depth extends 10 ? TUnknown : T ext
|
|
|
71
210
|
* Class representing a Zod schema definition.
|
|
72
211
|
* @implements {StaticSchemaValidator}
|
|
73
212
|
*/
|
|
74
|
-
declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObject$1<ZodRawShape>>(schema: T) => ZodResolve<T>), <T extends ZodIdiomaticSchema>(schema: T) => ZodResolve<T>, <T extends ZodIdiomaticSchema>(schema: T) => ZodOptional<ZodResolve<T>>, <T extends ZodIdiomaticSchema>(schema: T) => ZodArray<ZodResolve<T>>, <T extends ZodUnionContainer>(schemas: T) => ZodUnion<UnionZodResolve<T>>, <T extends LiteralSchema>(value: T) => ZodLiteral<
|
|
213
|
+
declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObject$1<ZodRawShape>>(schema: T) => ZodResolve<T>), <T extends ZodIdiomaticSchema>(schema: T) => ZodResolve<T>, <T extends ZodIdiomaticSchema>(schema: T) => ZodOptional<ZodResolve<T>>, <T extends ZodIdiomaticSchema>(schema: T) => ZodArray<ZodResolve<T>>, <T extends ZodUnionContainer>(schemas: T) => ZodUnion<UnionZodResolve<T>>, <T extends LiteralSchema>(value: T) => ZodLiteral<T>, <T extends Record<string, LiteralSchema>>(schemaEnum: T) => ZodUnion<[
|
|
75
214
|
{
|
|
76
215
|
[K in keyof T]: ZodLiteral<T[K]>;
|
|
77
216
|
}[keyof T]
|
|
78
|
-
]>, (value: unknown) => value is ZodType, <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T, value: unknown) => boolean, <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T, value: unknown) => ParseResult<ZodResolve<T>>, <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T) => SchemaObject> {
|
|
217
|
+
]>, <Args extends ZodTupleContainer, ReturnType extends ZodIdiomaticSchema>(args: Args, returnType: ReturnType) => ZodFunction<ZodTuple<TupleZodResolve<Args>, null>, ZodResolve<ReturnType>>, <Key extends ZodIdiomaticSchema, Value extends ZodIdiomaticSchema>(key: Key, value: Value) => ZodRecord<ZodRecordKey<Key>, ZodResolve<Value>>, <T extends ZodIdiomaticSchema>(schema: T) => ZodPromise<ZodResolve<T>>, (value: unknown) => value is ZodType, <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T, value: unknown) => boolean, <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T, value: unknown) => ParseResult<ZodResolve<T>>, <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T) => SchemaObject> {
|
|
79
218
|
_Type: "Zod";
|
|
80
219
|
_SchemaCatchall: ZodType;
|
|
81
220
|
_ValidSchemaObject: ZodObject$1<ZodRawShape> | ZodArray<ZodObject$1<ZodRawShape>>;
|
|
@@ -88,7 +227,10 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObjec
|
|
|
88
227
|
boolean: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
|
|
89
228
|
date: z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodDate>;
|
|
90
229
|
symbol: z.ZodSymbol;
|
|
91
|
-
nullish: ZodUnion<[z.ZodVoid, z.ZodNull, z.ZodUndefined]>;
|
|
230
|
+
nullish: z.ZodUnion<[z.ZodVoid, z.ZodNull, z.ZodUndefined]>;
|
|
231
|
+
void: z.ZodVoid;
|
|
232
|
+
null: z.ZodNull;
|
|
233
|
+
undefined: z.ZodUndefined;
|
|
92
234
|
any: z.ZodAny;
|
|
93
235
|
unknown: z.ZodUnknown;
|
|
94
236
|
never: z.ZodNever;
|
|
@@ -128,7 +270,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObjec
|
|
|
128
270
|
* @param {LiteralSchema} value - The literal value.
|
|
129
271
|
* @returns {ZodLiteral<ZodResolve<T>>} The literal schema.
|
|
130
272
|
*/
|
|
131
|
-
literal<T extends LiteralSchema>(value: T): ZodLiteral<
|
|
273
|
+
literal<T extends LiteralSchema>(value: T): ZodLiteral<T>;
|
|
132
274
|
/**
|
|
133
275
|
* Create an enum schema.
|
|
134
276
|
* @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
|
|
@@ -139,6 +281,26 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObjec
|
|
|
139
281
|
[K in keyof T]: ZodLiteral<T[K]>;
|
|
140
282
|
}[keyof T]
|
|
141
283
|
]>;
|
|
284
|
+
/**
|
|
285
|
+
* Create a function schema.
|
|
286
|
+
* @param {ZodTuple} args - The arguments of the function.
|
|
287
|
+
* @param {ZodAny} returnType - The return type of the function.
|
|
288
|
+
* @returns {ZodFunction<Args, ReturnType>} The function schema.
|
|
289
|
+
*/
|
|
290
|
+
function_<Args extends ZodTupleContainer, ReturnType extends ZodIdiomaticSchema>(args: Args, returnType: ReturnType): ZodFunction<ZodTuple<TupleZodResolve<Args>, null>, ZodResolve<ReturnType>>;
|
|
291
|
+
/**
|
|
292
|
+
* Create a record schema.
|
|
293
|
+
* @param {ZodIdiomaticSchema} key - The key schema.
|
|
294
|
+
* @param {ZodIdiomaticSchema} value - The value schema.
|
|
295
|
+
* @returns {ZodRecord<ZodResolve<Key>, ZodResolve<Value>>} The record schema.
|
|
296
|
+
*/
|
|
297
|
+
record<Key extends ZodIdiomaticSchema, Value extends ZodIdiomaticSchema>(key: Key, value: Value): ZodRecord<ZodRecordKey<Key>, ZodResolve<Value>>;
|
|
298
|
+
/**
|
|
299
|
+
* Create a promise schema.
|
|
300
|
+
* @param {ZodIdiomaticSchema} schema - The schema to use for the promise.
|
|
301
|
+
* @returns {ZodPromise<ZodResolve<T>>} The promise schema.
|
|
302
|
+
*/
|
|
303
|
+
promise<T extends ZodIdiomaticSchema>(schema: T): ZodPromise<ZodResolve<T>>;
|
|
142
304
|
/**
|
|
143
305
|
* Checks if a value is a Zod schema.
|
|
144
306
|
* @param {unknown} value - The value to check.
|
|
@@ -202,6 +364,24 @@ type UnboxedZodObjectSchema = UnboxedObjectSchema<ZodSchemaValidator>;
|
|
|
202
364
|
* Represents an idiomatic schema for Zod which can be an unboxed object schema or a literal schema.
|
|
203
365
|
*/
|
|
204
366
|
type ZodIdiomaticSchema = IdiomaticSchema<ZodSchemaValidator>;
|
|
367
|
+
/**
|
|
368
|
+
* Represents a container for a union of Zod idiomatic schemas.
|
|
369
|
+
*/
|
|
370
|
+
type ZodTupleContainer = readonly [] | readonly [ZodIdiomaticSchema, ...ZodIdiomaticSchema[]];
|
|
371
|
+
/**
|
|
372
|
+
* Resolves a union container to a tuple of resolved Zod idiomatic schemas.
|
|
373
|
+
*
|
|
374
|
+
* @template T - The union container to resolve.
|
|
375
|
+
*/
|
|
376
|
+
type TupleZodResolve<T extends ZodTupleContainer> = T extends [
|
|
377
|
+
infer A extends ZodIdiomaticSchema,
|
|
378
|
+
...infer B extends ZodIdiomaticSchema[]
|
|
379
|
+
] ? [
|
|
380
|
+
ZodResolve<A>,
|
|
381
|
+
...{
|
|
382
|
+
[K in keyof B]: ZodResolve<B[K]>;
|
|
383
|
+
}
|
|
384
|
+
] : [];
|
|
205
385
|
/**
|
|
206
386
|
* Represents a container for a union of Zod idiomatic schemas.
|
|
207
387
|
*/
|
|
@@ -227,14 +407,20 @@ type UnionZodResolve<T extends ZodUnionContainer> = T extends [
|
|
|
227
407
|
}
|
|
228
408
|
] : [ZodNever, ZodNever];
|
|
229
409
|
/**
|
|
230
|
-
* Resolves a Zod schema type T to its resolved type. The depth is limited to
|
|
410
|
+
* Resolves a Zod schema type T to its resolved type. The depth is limited to 29 to prevent infinite recursion.
|
|
231
411
|
*
|
|
232
412
|
* @template T - The Zod schema type to resolve.
|
|
233
413
|
* @template Depth - The current depth of the resolution.
|
|
234
414
|
*/
|
|
235
|
-
type ZodResolve<T, Depth extends number = 0> = Depth extends
|
|
415
|
+
type ZodResolve<T, Depth extends number = 0> = Depth extends 29 ? ZodUnknown : T extends LiteralSchema ? ZodLiteral<T> : T extends ZodType ? T : T extends UnboxedZodObjectSchema ? ZodObject<{
|
|
236
416
|
[K in keyof T]: ZodResolve<T[K], Increment<Depth>>;
|
|
237
|
-
}> : ZodNever;
|
|
417
|
+
}> extends infer R ? R : ZodNever : ZodNever;
|
|
418
|
+
/**
|
|
419
|
+
* Represents the key type of a Zod record schema.
|
|
420
|
+
*
|
|
421
|
+
* @template T - The Zod idiomatic schema to get the key type from.
|
|
422
|
+
*/
|
|
423
|
+
type ZodRecordKey<T extends ZodIdiomaticSchema> = ZodResolve<T> extends infer R ? R extends boolean ? never : unknown extends R ? never : R : never;
|
|
238
424
|
|
|
239
425
|
/**
|
|
240
426
|
* Represents an error with a path and message.
|
|
@@ -266,7 +452,7 @@ type ParseResult<T> = {
|
|
|
266
452
|
* @template ParseFunction - The function type for parsing a value against a schema.
|
|
267
453
|
* @template OpenAPIFunction - The function type for converting a schema into an OpenAPI schema object.
|
|
268
454
|
*/
|
|
269
|
-
interface SchemaValidator<CompilationFunction = <T>(schema: T) => unknown, SchematicFunction = <T>(schema: T) => unknown, OptionalFunction = <T>(schema: T) => unknown, ArrayFunction = <T>(schema: T) => unknown, UnionFunction = <T>(schemas: T[]) => unknown, LiteralFunction = <T extends LiteralSchema>(schema: T) => unknown, EnumFunction = <T extends LiteralSchema>(schemaEnum: Record<string, T>) => unknown, SchemaGuardFunction = <T>(value: unknown) => value is T, ValidationFunction = <T>(schema: T, value: unknown) => boolean, ParseFunction = <T>(schema: T, value: unknown) => ParseResult<SchemaResolve<T>>, OpenAPIFunction = <T>(schema: T) => SchemaObject> {
|
|
455
|
+
interface SchemaValidator<CompilationFunction = <T>(schema: T) => unknown, SchematicFunction = <T>(schema: T) => unknown, OptionalFunction = <T>(schema: T) => unknown, ArrayFunction = <T>(schema: T) => unknown, UnionFunction = <T>(schemas: T[]) => unknown, LiteralFunction = <T extends LiteralSchema>(schema: T) => unknown, EnumFunction = <T extends LiteralSchema>(schemaEnum: Record<string, T>) => unknown, FunctionFunction = <Args, ReturnType>(args: Args, returnType: ReturnType) => unknown, RecordFunction = <Key, Value>(key: Key, value: Value) => unknown, PromiseFunction = <T>(schema: T) => unknown, SchemaGuardFunction = <T>(value: unknown) => value is T, ValidationFunction = <T>(schema: T, value: unknown) => boolean, ParseFunction = <T>(schema: T, value: unknown) => ParseResult<SchemaResolve<T>>, OpenAPIFunction = <T>(schema: T) => SchemaObject> {
|
|
270
456
|
/**
|
|
271
457
|
* The type of the schema validator.
|
|
272
458
|
*/
|
|
@@ -380,6 +566,29 @@ interface SchemaValidator<CompilationFunction = <T>(schema: T) => unknown, Schem
|
|
|
380
566
|
* @returns {unknown} - The enum schema.
|
|
381
567
|
*/
|
|
382
568
|
enum_: EnumFunction;
|
|
569
|
+
/**
|
|
570
|
+
* Creates a function schema from a tuple of arguments and a return type.
|
|
571
|
+
*
|
|
572
|
+
* @param {Args} args - The arguments of the function.
|
|
573
|
+
* @param {ReturnType} returnType - The return type of the function.
|
|
574
|
+
* @returns {unknown} - The function schema.
|
|
575
|
+
*/
|
|
576
|
+
function_: FunctionFunction;
|
|
577
|
+
/**
|
|
578
|
+
* Creates a promise schema from a schema.
|
|
579
|
+
*
|
|
580
|
+
* @param {T} schema - The schema to use for the promise.
|
|
581
|
+
* @returns {unknown} - The promise schema.
|
|
582
|
+
*/
|
|
583
|
+
promise: PromiseFunction;
|
|
584
|
+
/**
|
|
585
|
+
* Creates a record schema from a key and value schema.
|
|
586
|
+
*
|
|
587
|
+
* @param {Key} key - The key schema.
|
|
588
|
+
* @param {Value} value - The value schema.
|
|
589
|
+
* @returns {unknown} - The record schema.
|
|
590
|
+
*/
|
|
591
|
+
record: RecordFunction;
|
|
383
592
|
/**
|
|
384
593
|
* Checks if a value is a schema.
|
|
385
594
|
*
|
|
@@ -414,7 +623,7 @@ interface SchemaValidator<CompilationFunction = <T>(schema: T) => unknown, Schem
|
|
|
414
623
|
/**
|
|
415
624
|
* Type representing any schema validator.
|
|
416
625
|
*/
|
|
417
|
-
type AnySchemaValidator = SchemaValidator<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown> & {
|
|
626
|
+
type AnySchemaValidator = SchemaValidator<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown> & {
|
|
418
627
|
/**
|
|
419
628
|
* The type of the schema resolver.
|
|
420
629
|
*/
|
|
@@ -463,7 +672,7 @@ type SchemaPrettify<T, SV extends AnySchemaValidator> = Prettify<SchemaTranslate
|
|
|
463
672
|
* @template T - The type of the schema.
|
|
464
673
|
* @template SV - The type of the schema validator.
|
|
465
674
|
*/
|
|
466
|
-
type Schema<T extends SV['_ValidSchemaObject'] | IdiomaticSchema<SV>, SV extends AnySchemaValidator> = SchemaPrettify<SchemaResolve<T>[SV['_Type']], SV
|
|
675
|
+
type Schema<T extends SV['_ValidSchemaObject'] | IdiomaticSchema<SV>, SV extends AnySchemaValidator> = SchemaTranslate<SchemaResolve<T>[SV['_Type']]>[SV['_Type']] extends infer Schema ? Schema extends (...args: infer Args) => infer Return ? (...args: Args) => Return : SchemaPrettify<SchemaResolve<T>[SV['_Type']], SV> : never;
|
|
467
676
|
/**
|
|
468
677
|
* Represents a schema for an unboxed object where each key can have an idiomatic schema.
|
|
469
678
|
*
|
|
@@ -493,4 +702,4 @@ type Increment<T extends number> = T extends 0 ? 1 : T extends 1 ? 2 : T extends
|
|
|
493
702
|
*/
|
|
494
703
|
type KeyTypes = string | number;
|
|
495
704
|
|
|
496
|
-
export { type AnySchemaValidator as A, type IdiomaticSchema as I, type KeyTypes as K, type LiteralSchema as L, type ParseError as P, type SchemaValidator as S,
|
|
705
|
+
export { type AnySchemaValidator as A, type ZodSchemaTranslate as B, type UnboxedZodObjectSchema as C, type IdiomaticSchema as I, type KeyTypes as K, type LiteralSchema as L, type ParseError as P, type SchemaValidator as S, TypeboxSchemaValidator as T, type UnboxedObjectSchema as U, ZodSchemaValidator as Z, type ParseResult as a, type SchemaResolve as b, type SchemaTranslate as c, type Schema as d, type Increment as e, type TIdiomaticSchema as f, type TResolve as g, type TUnionTupleContainer as h, type UnionTupleTResolve as i, type TCatchall as j, type TOuterArray as k, type TObjectShape as l, type TObject as m, type TSchemaTranslate as n, type UnboxedTObjectSchema as o, type ZodIdiomaticSchema as p, type ZodResolve as q, type ZodUnionContainer as r, type UnionZodResolve as s, type ZodTupleContainer as t, type TupleZodResolve as u, type ZodRecordKey as v, type ZodCatchall as w, type ZodOuterArray as x, type ZodObjectShape as y, type ZodObject as z };
|
|
@@ -1,126 +1,11 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
|
-
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
3
2
|
import * as _sinclair_typebox_compiler from '@sinclair/typebox/compiler';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export { l as TObjectShape, k as TOuterArray, m as TSchemaTranslate, n as UnboxedTObjectSchema } from '../../schema.types-BA3PeCI5.mjs';
|
|
3
|
+
import { T as TypeboxSchemaValidator, f as TIdiomaticSchema, g as TResolve, h as TUnionTupleContainer, i as UnionTupleTResolve, L as LiteralSchema, j as TCatchall, a as ParseResult } from '../../schema.types-BL6n8u4w.mjs';
|
|
4
|
+
export { m as TObject, l as TObjectShape, k as TOuterArray, n as TSchemaTranslate, o as UnboxedTObjectSchema } from '../../schema.types-BL6n8u4w.mjs';
|
|
7
5
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
8
|
-
import { TProperties, TOptional, TArray, TUnion, TLiteral, TSchema } from '@sinclair/typebox';
|
|
9
6
|
import '@forklaunch/common';
|
|
10
7
|
import 'zod';
|
|
11
8
|
|
|
12
|
-
/**
|
|
13
|
-
* Class representing a TypeBox schema definition.
|
|
14
|
-
* @implements {SchemaValidator}
|
|
15
|
-
*/
|
|
16
|
-
declare class TypeboxSchemaValidator implements SchemaValidator$1<(<T extends TObject<TProperties>>(schema: T) => TypeCheck<T>), <T extends TIdiomaticSchema>(schema: T) => TResolve<T>, <T extends TIdiomaticSchema>(schema: T) => TOptional<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => TArray<TResolve<T>>, <T extends TUnionContainer>(schemas: [...T]) => TUnion<UnionTResolve<T>>, <T extends LiteralSchema>(value: T) => TLiteral<T>, <T extends Record<string, LiteralSchema>>(schemaEnum: T) => TUnion<[
|
|
17
|
-
{
|
|
18
|
-
[K in keyof T]: TLiteral<T[K]>;
|
|
19
|
-
}[keyof T]
|
|
20
|
-
]>, (value: unknown) => value is TSchema, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => boolean, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => ParseResult<TResolve<T>>, <T extends TIdiomaticSchema | TCatchall>(schema: T) => SchemaObject> {
|
|
21
|
-
_Type: "TypeBox";
|
|
22
|
-
_SchemaCatchall: TSchema;
|
|
23
|
-
_ValidSchemaObject: TObject<TProperties> | TArray<TObject<TProperties>>;
|
|
24
|
-
string: _sinclair_typebox.TString;
|
|
25
|
-
uuid: _sinclair_typebox.TString;
|
|
26
|
-
uri: _sinclair_typebox.TString;
|
|
27
|
-
email: _sinclair_typebox.TString;
|
|
28
|
-
number: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TDate, _sinclair_typebox.TBigInt]>, number>;
|
|
29
|
-
bigint: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TBigInt, _sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TDate]>, bigint>;
|
|
30
|
-
boolean: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TString]>, boolean>;
|
|
31
|
-
date: _sinclair_typebox.TTransform<TUnion<[_sinclair_typebox.TDate, _sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>, Date>;
|
|
32
|
-
symbol: _sinclair_typebox.TSymbol;
|
|
33
|
-
nullish: TUnion<[_sinclair_typebox.TVoid, _sinclair_typebox.TNull, _sinclair_typebox.TUndefined]>;
|
|
34
|
-
any: _sinclair_typebox.TAny;
|
|
35
|
-
unknown: _sinclair_typebox.TUnknown;
|
|
36
|
-
never: _sinclair_typebox.TNever;
|
|
37
|
-
/**
|
|
38
|
-
* Extracts the error type of a schema for error messages.
|
|
39
|
-
*
|
|
40
|
-
* @param {TCatchall} schema - A schema that contains some type information.
|
|
41
|
-
* @returns The type of the schema for error messages.
|
|
42
|
-
*/
|
|
43
|
-
private errorType;
|
|
44
|
-
/**
|
|
45
|
-
* Compiles schema if this exists, for optimal performance.
|
|
46
|
-
*
|
|
47
|
-
* @param {TObject<TProperties>} schema - The schema to compile.
|
|
48
|
-
* @returns {TypeCheck<T>} - The compiled schema.
|
|
49
|
-
*/
|
|
50
|
-
compile<T extends TObject<TProperties>>(schema: T): TypeCheck<T>;
|
|
51
|
-
/**
|
|
52
|
-
* Convert a schema to a TypeBox schema.
|
|
53
|
-
* @param {TIdiomaticSchema} schema - The schema to convert.
|
|
54
|
-
* @returns {TResolve<T>} The resolved schema.
|
|
55
|
-
*/
|
|
56
|
-
schemify<T extends TIdiomaticSchema>(schema: T): TResolve<T>;
|
|
57
|
-
/**
|
|
58
|
-
* Make a schema optional.
|
|
59
|
-
* @param {TIdiomaticSchema} schema - The schema to make optional.
|
|
60
|
-
* @returns {TOptional<TResolve<T>>} The optional schema.
|
|
61
|
-
*/
|
|
62
|
-
optional<T extends TIdiomaticSchema>(schema: T): TOptional<TResolve<T>>;
|
|
63
|
-
/**
|
|
64
|
-
* Create an array schema.
|
|
65
|
-
* @param {TIdiomaticSchema} schema - The schema to use for array items.
|
|
66
|
-
* @returns {TArray<TResolve<T>>} The array schema.
|
|
67
|
-
*/
|
|
68
|
-
array<T extends TIdiomaticSchema>(schema: T): TArray<TResolve<T>>;
|
|
69
|
-
/**
|
|
70
|
-
* Create a union schema.
|
|
71
|
-
* @param {TUnionContainer} schemas - The schemas to union.
|
|
72
|
-
* @returns {TUnion<UnionTResolve<T>>} The union schema.
|
|
73
|
-
*
|
|
74
|
-
* WARNING: If "nullish" or TUndefined is included in the union, the key will still be expected.
|
|
75
|
-
* This is a limitation of TypeBox. Consider using "optional" instead.
|
|
76
|
-
*/
|
|
77
|
-
union<T extends TUnionContainer>(schemas: [...T]): TUnion<UnionTResolve<T>>;
|
|
78
|
-
/**
|
|
79
|
-
* Create a literal schema.
|
|
80
|
-
* @param {LiteralSchema} value - The literal value.
|
|
81
|
-
* @returns {TLiteral<T>} The literal schema.
|
|
82
|
-
*/
|
|
83
|
-
literal<T extends LiteralSchema>(value: T): TLiteral<T>;
|
|
84
|
-
/**
|
|
85
|
-
* Create an enum schema.
|
|
86
|
-
* @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
|
|
87
|
-
* @returns {TUnion<UnionTResolve<T[]>>} The enum schema.
|
|
88
|
-
*/
|
|
89
|
-
enum_<T extends Record<string, LiteralSchema>>(schemaEnum: T): TUnion<[
|
|
90
|
-
{
|
|
91
|
-
[K in keyof T]: TLiteral<T[K]>;
|
|
92
|
-
}[keyof T]
|
|
93
|
-
]>;
|
|
94
|
-
/**
|
|
95
|
-
* Check if a value is a TypeBox object schema.
|
|
96
|
-
* @param {unknown} value - The value to check.
|
|
97
|
-
* @returns {boolean} True if the value is a TypeBox object schema.
|
|
98
|
-
*/
|
|
99
|
-
isSchema(value: unknown): value is TSchema;
|
|
100
|
-
/**
|
|
101
|
-
* Validate a value against a schema.
|
|
102
|
-
*
|
|
103
|
-
* @param {TSchema} schema - The schema to validate against.
|
|
104
|
-
* @param {unknown} value - The value to validate.
|
|
105
|
-
* @returns {boolean} True if valid, otherwise false.
|
|
106
|
-
*/
|
|
107
|
-
validate<T extends TIdiomaticSchema | TSchema>(schema: T | TypeCheck<TResolve<T>>, value: unknown): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Parse a value against a schema.
|
|
110
|
-
*
|
|
111
|
-
* @param {TSchema} schema - The schema to validate against.
|
|
112
|
-
* @param {unknown} value - The value to validate.
|
|
113
|
-
* @returns {ParseResult<TResolve<T>>} The parsing result.
|
|
114
|
-
*/
|
|
115
|
-
parse<T extends TIdiomaticSchema | TSchema>(schema: T | TypeCheck<TResolve<T>>, value: unknown): ParseResult<TResolve<T>>;
|
|
116
|
-
/**
|
|
117
|
-
* Convert a schema to an OpenAPI schema object.
|
|
118
|
-
* @param {TIdiomaticSchema | TSchema} schema - The schema to convert.
|
|
119
|
-
* @returns {SchemaObject} The OpenAPI schema object.
|
|
120
|
-
*/
|
|
121
|
-
openapi<T extends TIdiomaticSchema | TSchema>(schema: T): SchemaObject;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
9
|
/**
|
|
125
10
|
* Factory function for creating a TypeboxSchemaValidator instance.
|
|
126
11
|
* @returns {TypeboxSchemaValidator} The TypeboxSchemaValidator instance.
|
|
@@ -166,6 +51,18 @@ declare const symbol: _sinclair_typebox.TSymbol;
|
|
|
166
51
|
* TypeBox schema definition for undefined, null, void types.
|
|
167
52
|
*/
|
|
168
53
|
declare const nullish: _sinclair_typebox.TUnion<[_sinclair_typebox.TVoid, _sinclair_typebox.TNull, _sinclair_typebox.TUndefined]>;
|
|
54
|
+
/**
|
|
55
|
+
* TypeBox schema definition for void type.
|
|
56
|
+
*/
|
|
57
|
+
declare const void_: _sinclair_typebox.TVoid;
|
|
58
|
+
/**
|
|
59
|
+
* TypeBox schema definition for null type.
|
|
60
|
+
*/
|
|
61
|
+
declare const null_: _sinclair_typebox.TNull;
|
|
62
|
+
/**
|
|
63
|
+
* TypeBox schema definition for undefined type.
|
|
64
|
+
*/
|
|
65
|
+
declare const undefined_: _sinclair_typebox.TUndefined;
|
|
169
66
|
/**
|
|
170
67
|
* TypeBox schema definition for any type.
|
|
171
68
|
*/
|
|
@@ -193,7 +90,7 @@ declare const array: <T extends TIdiomaticSchema>(schema: T) => _sinclair_typebo
|
|
|
193
90
|
/**
|
|
194
91
|
* Defines a union for a valid schema.
|
|
195
92
|
*/
|
|
196
|
-
declare const union: <T extends
|
|
93
|
+
declare const union: <T extends TUnionTupleContainer>(schemas: [...T]) => _sinclair_typebox.TUnion<UnionTupleTResolve<T>>;
|
|
197
94
|
/**
|
|
198
95
|
* Defines a literal for a valid schema.
|
|
199
96
|
*/
|
|
@@ -202,6 +99,18 @@ declare const literal: <T extends LiteralSchema>(value: T) => _sinclair_typebox.
|
|
|
202
99
|
* Defines an enum for a valid schema.
|
|
203
100
|
*/
|
|
204
101
|
declare const enum_: <T extends Record<string, LiteralSchema>>(schemaEnum: T) => _sinclair_typebox.TUnion<[{ [K in keyof T]: _sinclair_typebox.TLiteral<T[K]>; }[keyof T]]>;
|
|
102
|
+
/**
|
|
103
|
+
* Defines a function for a valid schema.
|
|
104
|
+
*/
|
|
105
|
+
declare const function_: <Args extends TUnionTupleContainer, ReturnType extends TIdiomaticSchema>(args: [...Args], returnType: ReturnType) => _sinclair_typebox.TFunction<UnionTupleTResolve<Args>, TResolve<ReturnType>>;
|
|
106
|
+
/**
|
|
107
|
+
* Defines a record for a valid schema.
|
|
108
|
+
*/
|
|
109
|
+
declare const record: <Key extends TIdiomaticSchema, Value extends TIdiomaticSchema>(key: Key, value: Value) => _sinclair_typebox.TRecord<TResolve<Key>, TResolve<Value>>;
|
|
110
|
+
/**
|
|
111
|
+
* Defines a promise for a valid schema.
|
|
112
|
+
*/
|
|
113
|
+
declare const promise: <T extends TIdiomaticSchema>(schema: T) => _sinclair_typebox.TPromise<TResolve<T>>;
|
|
205
114
|
/**
|
|
206
115
|
* Checks if a value is a TypeBox schema.
|
|
207
116
|
*/
|
|
@@ -209,14 +118,14 @@ declare const isSchema: (value: unknown) => value is _sinclair_typebox.TSchema;
|
|
|
209
118
|
/**
|
|
210
119
|
* Validates a value against a valid schema.
|
|
211
120
|
*/
|
|
212
|
-
declare const validate: <T extends TIdiomaticSchema |
|
|
121
|
+
declare const validate: <T extends TIdiomaticSchema | TCatchall>(schema: T | _sinclair_typebox_compiler.TypeCheck<TResolve<T>>, value: unknown) => boolean;
|
|
213
122
|
/**
|
|
214
123
|
* Parses a value against a valid schema.
|
|
215
124
|
*/
|
|
216
|
-
declare const parse: <T extends TIdiomaticSchema |
|
|
125
|
+
declare const parse: <T extends TIdiomaticSchema | TCatchall>(schema: T | _sinclair_typebox_compiler.TypeCheck<TResolve<T>>, value: unknown) => ParseResult<TResolve<T>>;
|
|
217
126
|
/**
|
|
218
127
|
* Generates an OpenAPI schema object from a valid schema.
|
|
219
128
|
*/
|
|
220
|
-
declare const openapi: <T extends TIdiomaticSchema |
|
|
129
|
+
declare const openapi: <T extends TIdiomaticSchema | TCatchall>(schema: T) => openapi3_ts_oas31.SchemaObject;
|
|
221
130
|
|
|
222
|
-
export { SchemaValidator, TCatchall, TIdiomaticSchema,
|
|
131
|
+
export { SchemaValidator, TCatchall, TIdiomaticSchema, TResolve, TUnionTupleContainer, TypeboxSchemaValidator, UnionTupleTResolve, any, array, bigint, boolean, date, email, enum_, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|