@forklaunch/validator 0.10.14 → 0.10.16
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 +1 -1
- package/lib/__test__/utils/mockSchemaValidator.d.ts +1 -1
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/{schema.types-wl77iEsE.d.mts → schema.types-CR2kDA3N.d.mts} +2 -2
- package/lib/{schema.types-wl77iEsE.d.ts → schema.types-CR2kDA3N.d.ts} +2 -2
- package/lib/src/typebox/index.d.mts +2 -2
- package/lib/src/typebox/index.d.ts +2 -2
- package/lib/src/typebox/index.js +52 -15
- package/lib/src/typebox/index.mjs +53 -16
- package/lib/src/zod/index.d.mts +2 -2
- package/lib/src/zod/index.d.ts +2 -2
- package/lib/src/zod/index.js +23 -2
- package/lib/src/zod/index.mjs +23 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
|
-
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-
|
|
2
|
+
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-CR2kDA3N.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
|
-
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-
|
|
2
|
+
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-CR2kDA3N.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParseError } from './schema.types-
|
|
2
|
-
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-
|
|
1
|
+
import { P as ParseError } from './schema.types-CR2kDA3N.mjs';
|
|
2
|
+
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-CR2kDA3N.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParseError } from './schema.types-
|
|
2
|
-
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-
|
|
1
|
+
import { P as ParseError } from './schema.types-CR2kDA3N.js';
|
|
2
|
+
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-CR2kDA3N.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -40,7 +40,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T>() => TTrans
|
|
|
40
40
|
unknown: TUnknown;
|
|
41
41
|
never: TNever;
|
|
42
42
|
binary: TTransform<TString, Uint8Array<ArrayBuffer>>;
|
|
43
|
-
file: TTransform<TUnsafe<Buffer<ArrayBuffer
|
|
43
|
+
file: TTransform<TUnion<[TUnsafe<Buffer>, TUnsafe<ArrayBuffer>, TUnsafe<Blob>, TString]>, Blob>;
|
|
44
44
|
type: <T>() => TTransform<TAny, T>;
|
|
45
45
|
/**
|
|
46
46
|
* Extracts the error type of a schema for error messages.
|
|
@@ -251,7 +251,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T>() => ZodType<T>
|
|
|
251
251
|
unknown: z.ZodUnknown;
|
|
252
252
|
never: z.ZodNever;
|
|
253
253
|
binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBuffer>, string>;
|
|
254
|
-
file: z.ZodEffects<z.ZodType<Buffer<
|
|
254
|
+
file: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Blob, z.ZodTypeDef, Blob>, z.ZodString]>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>;
|
|
255
255
|
type: <T>() => ZodType<T>;
|
|
256
256
|
/**
|
|
257
257
|
* Compiles schema if this exists, for optimal performance.
|
|
@@ -40,7 +40,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T>() => TTrans
|
|
|
40
40
|
unknown: TUnknown;
|
|
41
41
|
never: TNever;
|
|
42
42
|
binary: TTransform<TString, Uint8Array<ArrayBuffer>>;
|
|
43
|
-
file: TTransform<TUnsafe<Buffer<ArrayBuffer
|
|
43
|
+
file: TTransform<TUnion<[TUnsafe<Buffer>, TUnsafe<ArrayBuffer>, TUnsafe<Blob>, TString]>, Blob>;
|
|
44
44
|
type: <T>() => TTransform<TAny, T>;
|
|
45
45
|
/**
|
|
46
46
|
* Extracts the error type of a schema for error messages.
|
|
@@ -251,7 +251,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T>() => ZodType<T>
|
|
|
251
251
|
unknown: z.ZodUnknown;
|
|
252
252
|
never: z.ZodNever;
|
|
253
253
|
binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBuffer>, string>;
|
|
254
|
-
file: z.ZodEffects<z.ZodType<Buffer<
|
|
254
|
+
file: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Blob, z.ZodTypeDef, Blob>, z.ZodString]>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>, Blob, string | ArrayBuffer | Buffer<ArrayBufferLike> | Blob>;
|
|
255
255
|
type: <T>() => ZodType<T>;
|
|
256
256
|
/**
|
|
257
257
|
* Compiles schema if this exists, for optimal performance.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@sinclair/typebox';
|
|
2
|
-
import { T as TypeboxSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-
|
|
2
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-CR2kDA3N.mjs';
|
|
3
|
+
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-CR2kDA3N.mjs';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@sinclair/typebox';
|
|
2
|
-
import { T as TypeboxSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-
|
|
2
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-CR2kDA3N.js';
|
|
3
|
+
export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-CR2kDA3N.js';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
package/lib/src/typebox/index.js
CHANGED
|
@@ -257,14 +257,46 @@ var TypeboxSchemaValidator = class {
|
|
|
257
257
|
return "";
|
|
258
258
|
});
|
|
259
259
|
file = import_typebox.Type.Transform(
|
|
260
|
-
import_typebox.Type.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
import_typebox.Type.Union([
|
|
261
|
+
import_typebox.Type.Unsafe({
|
|
262
|
+
errorType: "binary",
|
|
263
|
+
format: "binary",
|
|
264
|
+
example: "a raw buffer or file stream",
|
|
265
|
+
title: "File"
|
|
266
|
+
}),
|
|
267
|
+
import_typebox.Type.Unsafe({
|
|
268
|
+
errorType: "binary",
|
|
269
|
+
format: "binary",
|
|
270
|
+
example: "an array buffer",
|
|
271
|
+
title: "File"
|
|
272
|
+
}),
|
|
273
|
+
import_typebox.Type.Unsafe({
|
|
274
|
+
errorType: "binary",
|
|
275
|
+
format: "binary",
|
|
276
|
+
example: "a blob object",
|
|
277
|
+
title: "File"
|
|
278
|
+
}),
|
|
279
|
+
import_typebox.Type.String({
|
|
280
|
+
errorType: "binary",
|
|
281
|
+
format: "binary",
|
|
282
|
+
example: "a string content",
|
|
283
|
+
title: "File"
|
|
284
|
+
})
|
|
285
|
+
])
|
|
266
286
|
).Decode((value) => {
|
|
267
|
-
|
|
287
|
+
if (value instanceof Buffer) {
|
|
288
|
+
return new import_common.InMemoryBlob(value);
|
|
289
|
+
}
|
|
290
|
+
if (value instanceof ArrayBuffer) {
|
|
291
|
+
return new import_common.InMemoryBlob(Buffer.from(value));
|
|
292
|
+
}
|
|
293
|
+
if (value instanceof Blob) {
|
|
294
|
+
return value;
|
|
295
|
+
}
|
|
296
|
+
if (typeof value === "string") {
|
|
297
|
+
return new import_common.InMemoryBlob(Buffer.from(value));
|
|
298
|
+
}
|
|
299
|
+
return new import_common.InMemoryBlob(Buffer.from(value));
|
|
268
300
|
}).Encode((value) => value.content);
|
|
269
301
|
type = () => this.any;
|
|
270
302
|
/**
|
|
@@ -304,7 +336,7 @@ var TypeboxSchemaValidator = class {
|
|
|
304
336
|
}
|
|
305
337
|
const newSchema = {};
|
|
306
338
|
Object.getOwnPropertyNames(schema).forEach((key) => {
|
|
307
|
-
if (import_typebox.KindGuard.IsSchema(schema[key])) {
|
|
339
|
+
if (import_typebox.KindGuard.IsSchema(schema[key]) || import_typebox.KindGuard.IsTransform(schema[key])) {
|
|
308
340
|
newSchema[key] = schema[key];
|
|
309
341
|
} else {
|
|
310
342
|
const schemified = this.schemify(schema[key]);
|
|
@@ -522,20 +554,25 @@ var TypeboxSchemaValidator = class {
|
|
|
522
554
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
523
555
|
*/
|
|
524
556
|
openapi(schema) {
|
|
525
|
-
|
|
557
|
+
const schemified = this.schemify(schema);
|
|
558
|
+
let processedSchema;
|
|
526
559
|
if (import_typebox.KindGuard.IsDate(schemified)) {
|
|
527
|
-
|
|
560
|
+
processedSchema = import_typebox.Type.String({
|
|
528
561
|
format: "date-time"
|
|
529
562
|
});
|
|
563
|
+
} else {
|
|
564
|
+
processedSchema = (0, import_common.deepCloneWithoutUndefined)(schemified);
|
|
530
565
|
}
|
|
531
|
-
const newSchema = Object.assign({},
|
|
566
|
+
const newSchema = Object.assign({}, processedSchema);
|
|
532
567
|
if (Object.hasOwn(newSchema, "properties")) {
|
|
533
568
|
if (newSchema.properties) {
|
|
534
|
-
Object.entries({ ...
|
|
535
|
-
|
|
536
|
-
|
|
569
|
+
Object.entries({ ...processedSchema.properties }).forEach(
|
|
570
|
+
([key, value]) => {
|
|
571
|
+
if (import_typebox.KindGuard.IsSchema(value) && newSchema.properties) {
|
|
572
|
+
newSchema.properties[key] = this.openapi(value);
|
|
573
|
+
}
|
|
537
574
|
}
|
|
538
|
-
|
|
575
|
+
);
|
|
539
576
|
}
|
|
540
577
|
}
|
|
541
578
|
if (Object.hasOwn(newSchema, "items")) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export * from "@sinclair/typebox";
|
|
3
3
|
|
|
4
4
|
// src/typebox/typeboxSchemaValidator.ts
|
|
5
|
-
import { InMemoryBlob } from "@forklaunch/common";
|
|
5
|
+
import { deepCloneWithoutUndefined, InMemoryBlob } from "@forklaunch/common";
|
|
6
6
|
import {
|
|
7
7
|
FormatRegistry,
|
|
8
8
|
Kind,
|
|
@@ -208,14 +208,46 @@ var TypeboxSchemaValidator = class {
|
|
|
208
208
|
return "";
|
|
209
209
|
});
|
|
210
210
|
file = Type.Transform(
|
|
211
|
-
Type.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
Type.Union([
|
|
212
|
+
Type.Unsafe({
|
|
213
|
+
errorType: "binary",
|
|
214
|
+
format: "binary",
|
|
215
|
+
example: "a raw buffer or file stream",
|
|
216
|
+
title: "File"
|
|
217
|
+
}),
|
|
218
|
+
Type.Unsafe({
|
|
219
|
+
errorType: "binary",
|
|
220
|
+
format: "binary",
|
|
221
|
+
example: "an array buffer",
|
|
222
|
+
title: "File"
|
|
223
|
+
}),
|
|
224
|
+
Type.Unsafe({
|
|
225
|
+
errorType: "binary",
|
|
226
|
+
format: "binary",
|
|
227
|
+
example: "a blob object",
|
|
228
|
+
title: "File"
|
|
229
|
+
}),
|
|
230
|
+
Type.String({
|
|
231
|
+
errorType: "binary",
|
|
232
|
+
format: "binary",
|
|
233
|
+
example: "a string content",
|
|
234
|
+
title: "File"
|
|
235
|
+
})
|
|
236
|
+
])
|
|
217
237
|
).Decode((value) => {
|
|
218
|
-
|
|
238
|
+
if (value instanceof Buffer) {
|
|
239
|
+
return new InMemoryBlob(value);
|
|
240
|
+
}
|
|
241
|
+
if (value instanceof ArrayBuffer) {
|
|
242
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
243
|
+
}
|
|
244
|
+
if (value instanceof Blob) {
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
if (typeof value === "string") {
|
|
248
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
249
|
+
}
|
|
250
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
219
251
|
}).Encode((value) => value.content);
|
|
220
252
|
type = () => this.any;
|
|
221
253
|
/**
|
|
@@ -255,7 +287,7 @@ var TypeboxSchemaValidator = class {
|
|
|
255
287
|
}
|
|
256
288
|
const newSchema = {};
|
|
257
289
|
Object.getOwnPropertyNames(schema).forEach((key) => {
|
|
258
|
-
if (KindGuard.IsSchema(schema[key])) {
|
|
290
|
+
if (KindGuard.IsSchema(schema[key]) || KindGuard.IsTransform(schema[key])) {
|
|
259
291
|
newSchema[key] = schema[key];
|
|
260
292
|
} else {
|
|
261
293
|
const schemified = this.schemify(schema[key]);
|
|
@@ -473,20 +505,25 @@ var TypeboxSchemaValidator = class {
|
|
|
473
505
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
474
506
|
*/
|
|
475
507
|
openapi(schema) {
|
|
476
|
-
|
|
508
|
+
const schemified = this.schemify(schema);
|
|
509
|
+
let processedSchema;
|
|
477
510
|
if (KindGuard.IsDate(schemified)) {
|
|
478
|
-
|
|
511
|
+
processedSchema = Type.String({
|
|
479
512
|
format: "date-time"
|
|
480
513
|
});
|
|
514
|
+
} else {
|
|
515
|
+
processedSchema = deepCloneWithoutUndefined(schemified);
|
|
481
516
|
}
|
|
482
|
-
const newSchema = Object.assign({},
|
|
517
|
+
const newSchema = Object.assign({}, processedSchema);
|
|
483
518
|
if (Object.hasOwn(newSchema, "properties")) {
|
|
484
519
|
if (newSchema.properties) {
|
|
485
|
-
Object.entries({ ...
|
|
486
|
-
|
|
487
|
-
|
|
520
|
+
Object.entries({ ...processedSchema.properties }).forEach(
|
|
521
|
+
([key, value]) => {
|
|
522
|
+
if (KindGuard.IsSchema(value) && newSchema.properties) {
|
|
523
|
+
newSchema.properties[key] = this.openapi(value);
|
|
524
|
+
}
|
|
488
525
|
}
|
|
489
|
-
|
|
526
|
+
);
|
|
490
527
|
}
|
|
491
528
|
}
|
|
492
529
|
if (Object.hasOwn(newSchema, "items")) {
|
package/lib/src/zod/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodDate, ZodEffects, ZodEnum, ZodFunction, ZodLiteral, ZodNever, ZodNull, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodRecord, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod/v3';
|
|
2
|
-
import { Z as ZodSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-
|
|
2
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-CR2kDA3N.mjs';
|
|
3
|
+
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-CR2kDA3N.mjs';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox';
|
package/lib/src/zod/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodDate, ZodEffects, ZodEnum, ZodFunction, ZodLiteral, ZodNever, ZodNull, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodRecord, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod/v3';
|
|
2
|
-
import { Z as ZodSchemaValidator } from '../../schema.types-
|
|
3
|
-
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-
|
|
2
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-CR2kDA3N.js';
|
|
3
|
+
export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-CR2kDA3N.js';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox';
|
package/lib/src/zod/index.js
CHANGED
|
@@ -58,6 +58,7 @@ __export(zod_exports, {
|
|
|
58
58
|
module.exports = __toCommonJS(zod_exports);
|
|
59
59
|
|
|
60
60
|
// src/zod/zodSchemaValidator.ts
|
|
61
|
+
var import_common = require("@forklaunch/common");
|
|
61
62
|
var import_v32 = require("zod/v3");
|
|
62
63
|
|
|
63
64
|
// shims/zod-v3-openapi/zod-openapi.ts
|
|
@@ -774,8 +775,27 @@ var ZodSchemaValidator = class {
|
|
|
774
775
|
format: "binary",
|
|
775
776
|
example: "a base-64 encodable string"
|
|
776
777
|
});
|
|
777
|
-
file = import_v32.z.
|
|
778
|
+
file = import_v32.z.union([
|
|
779
|
+
import_v32.z.instanceof(Buffer),
|
|
780
|
+
import_v32.z.instanceof(ArrayBuffer),
|
|
781
|
+
import_v32.z.instanceof(Blob),
|
|
782
|
+
import_v32.z.string()
|
|
783
|
+
]).transform((val) => {
|
|
784
|
+
if (val instanceof Buffer) {
|
|
785
|
+
return new Blob([val]);
|
|
786
|
+
}
|
|
787
|
+
if (val instanceof ArrayBuffer) {
|
|
788
|
+
return new Blob([val]);
|
|
789
|
+
}
|
|
790
|
+
if (val instanceof Blob) {
|
|
791
|
+
return val;
|
|
792
|
+
}
|
|
793
|
+
if (typeof val === "string") {
|
|
794
|
+
return new Blob([val]);
|
|
795
|
+
}
|
|
778
796
|
return new Blob([val]);
|
|
797
|
+
}).refine((val) => val instanceof Blob, {
|
|
798
|
+
message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
|
|
779
799
|
}).openapi({
|
|
780
800
|
title: "File",
|
|
781
801
|
type: "string",
|
|
@@ -960,7 +980,8 @@ var ZodSchemaValidator = class {
|
|
|
960
980
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
961
981
|
*/
|
|
962
982
|
openapi(schema) {
|
|
963
|
-
|
|
983
|
+
const schemified = this.schemify(schema);
|
|
984
|
+
return generateSchema((0, import_common.deepCloneWithoutUndefined)(schemified));
|
|
964
985
|
}
|
|
965
986
|
};
|
|
966
987
|
|
package/lib/src/zod/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/zod/zodSchemaValidator.ts
|
|
2
|
+
import { deepCloneWithoutUndefined } from "@forklaunch/common";
|
|
2
3
|
import {
|
|
3
4
|
z as z2,
|
|
4
5
|
ZodType
|
|
@@ -718,8 +719,27 @@ var ZodSchemaValidator = class {
|
|
|
718
719
|
format: "binary",
|
|
719
720
|
example: "a base-64 encodable string"
|
|
720
721
|
});
|
|
721
|
-
file = z2.
|
|
722
|
+
file = z2.union([
|
|
723
|
+
z2.instanceof(Buffer),
|
|
724
|
+
z2.instanceof(ArrayBuffer),
|
|
725
|
+
z2.instanceof(Blob),
|
|
726
|
+
z2.string()
|
|
727
|
+
]).transform((val) => {
|
|
728
|
+
if (val instanceof Buffer) {
|
|
729
|
+
return new Blob([val]);
|
|
730
|
+
}
|
|
731
|
+
if (val instanceof ArrayBuffer) {
|
|
732
|
+
return new Blob([val]);
|
|
733
|
+
}
|
|
734
|
+
if (val instanceof Blob) {
|
|
735
|
+
return val;
|
|
736
|
+
}
|
|
737
|
+
if (typeof val === "string") {
|
|
738
|
+
return new Blob([val]);
|
|
739
|
+
}
|
|
722
740
|
return new Blob([val]);
|
|
741
|
+
}).refine((val) => val instanceof Blob, {
|
|
742
|
+
message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
|
|
723
743
|
}).openapi({
|
|
724
744
|
title: "File",
|
|
725
745
|
type: "string",
|
|
@@ -904,7 +924,8 @@ var ZodSchemaValidator = class {
|
|
|
904
924
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
905
925
|
*/
|
|
906
926
|
openapi(schema) {
|
|
907
|
-
|
|
927
|
+
const schemified = this.schemify(schema);
|
|
928
|
+
return generateSchema(deepCloneWithoutUndefined(schemified));
|
|
908
929
|
}
|
|
909
930
|
};
|
|
910
931
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/validator",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.16",
|
|
4
4
|
"description": "Schema validator for ForkLaunch components.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"@sinclair/typebox": "^0.34.41",
|
|
62
62
|
"ts-deepmerge": "^7.0.3",
|
|
63
63
|
"zod": "^4.1.11",
|
|
64
|
-
"@forklaunch/common": "0.6.
|
|
64
|
+
"@forklaunch/common": "0.6.16"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@eslint/js": "^9.
|
|
67
|
+
"@eslint/js": "^9.37.0",
|
|
68
68
|
"@types/jest": "^30.0.0",
|
|
69
|
-
"@types/node": "^24.6.
|
|
70
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
69
|
+
"@types/node": "^24.6.2",
|
|
70
|
+
"@typescript/native-preview": "7.0.0-dev.20251003.1",
|
|
71
71
|
"@vitest/coverage-v8": "^3.2.4",
|
|
72
72
|
"eslint-config-prettier": "^10.1.8",
|
|
73
73
|
"eslint-plugin-prettier": "^5.5.4",
|