@composio/json-schema-to-zod 0.1.14 → 0.1.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/dist/index.cjs +52 -48
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -26
- package/package.json +9 -8
package/dist/index.cjs
CHANGED
|
@@ -35,10 +35,10 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// src/parsers/parse-schema.ts
|
|
38
|
-
var z16 = __toESM(require("zod"), 1);
|
|
38
|
+
var z16 = __toESM(require("zod/v3"), 1);
|
|
39
39
|
|
|
40
40
|
// src/parsers/parse-all-of.ts
|
|
41
|
-
var
|
|
41
|
+
var import_v3 = require("zod/v3");
|
|
42
42
|
|
|
43
43
|
// src/utils/half.ts
|
|
44
44
|
var half = (arr) => {
|
|
@@ -63,7 +63,7 @@ var ensureOriginalIndex = (arr) => {
|
|
|
63
63
|
};
|
|
64
64
|
function parseAllOf(jsonSchema, refs) {
|
|
65
65
|
if (jsonSchema.allOf.length === 0) {
|
|
66
|
-
return
|
|
66
|
+
return import_v3.z.never();
|
|
67
67
|
}
|
|
68
68
|
if (jsonSchema.allOf.length === 1) {
|
|
69
69
|
const item = jsonSchema.allOf[0];
|
|
@@ -73,24 +73,24 @@ function parseAllOf(jsonSchema, refs) {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
const [left, right] = half(ensureOriginalIndex(jsonSchema.allOf));
|
|
76
|
-
return
|
|
76
|
+
return import_v3.z.intersection(parseAllOf({ allOf: left }, refs), parseAllOf({ allOf: right }, refs));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// src/parsers/parse-any-of.ts
|
|
80
|
-
var
|
|
80
|
+
var import_v32 = require("zod/v3");
|
|
81
81
|
var parseAnyOf = (jsonSchema, refs) => {
|
|
82
82
|
return jsonSchema.anyOf.length ? jsonSchema.anyOf.length === 1 ? parseSchema(jsonSchema.anyOf[0], {
|
|
83
83
|
...refs,
|
|
84
84
|
path: [...refs.path, "anyOf", 0]
|
|
85
|
-
}) :
|
|
85
|
+
}) : import_v32.z.union(
|
|
86
86
|
jsonSchema.anyOf.map(
|
|
87
87
|
(schema, i) => parseSchema(schema, { ...refs, path: [...refs.path, "anyOf", i] })
|
|
88
88
|
)
|
|
89
|
-
) :
|
|
89
|
+
) : import_v32.z.any();
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
// src/parsers/parse-array.ts
|
|
93
|
-
var
|
|
93
|
+
var import_v33 = require("zod/v3");
|
|
94
94
|
|
|
95
95
|
// src/utils/extend-schema.ts
|
|
96
96
|
function extendSchemaWithMessage(zodSchema, jsonSchema, key, extend) {
|
|
@@ -158,13 +158,13 @@ var parseArray = (jsonSchema, refs) => {
|
|
|
158
158
|
return parseSchema(newSchema, refs);
|
|
159
159
|
}
|
|
160
160
|
if (Array.isArray(jsonSchema.items)) {
|
|
161
|
-
return
|
|
161
|
+
return import_v33.z.tuple(
|
|
162
162
|
jsonSchema.items.map(
|
|
163
163
|
(v, i) => parseSchema(v, { ...refs, path: [...refs.path, "items", i] })
|
|
164
164
|
)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
let zodSchema = !jsonSchema.items ?
|
|
167
|
+
let zodSchema = !jsonSchema.items ? import_v33.z.array(import_v33.z.any()) : import_v33.z.array(parseSchema(jsonSchema.items, { ...refs, path: [...refs.path, "items"] }));
|
|
168
168
|
zodSchema = extendSchemaWithMessage(
|
|
169
169
|
zodSchema,
|
|
170
170
|
jsonSchema,
|
|
@@ -197,42 +197,42 @@ var parseArray = (jsonSchema, refs) => {
|
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
// src/parsers/parse-boolean.ts
|
|
200
|
-
var
|
|
200
|
+
var import_v34 = require("zod/v3");
|
|
201
201
|
var parseBoolean = (_jsonSchema) => {
|
|
202
|
-
return
|
|
202
|
+
return import_v34.z.boolean();
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
// src/parsers/parse-const.ts
|
|
206
|
-
var
|
|
206
|
+
var import_v35 = require("zod/v3");
|
|
207
207
|
var parseConst = (jsonSchema) => {
|
|
208
|
-
return
|
|
208
|
+
return import_v35.z.literal(jsonSchema.const);
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
// src/parsers/parse-default.ts
|
|
212
|
-
var
|
|
212
|
+
var import_v36 = require("zod/v3");
|
|
213
213
|
var parseDefault = (_jsonSchema) => {
|
|
214
|
-
return
|
|
214
|
+
return import_v36.z.any();
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
// src/parsers/parse-enum.ts
|
|
218
|
-
var
|
|
218
|
+
var import_v37 = require("zod/v3");
|
|
219
219
|
var parseEnum = (jsonSchema) => {
|
|
220
220
|
if (jsonSchema.enum.length === 0) {
|
|
221
|
-
return
|
|
221
|
+
return import_v37.z.never();
|
|
222
222
|
}
|
|
223
223
|
if (jsonSchema.enum.length === 1) {
|
|
224
|
-
return
|
|
224
|
+
return import_v37.z.literal(jsonSchema.enum[0]);
|
|
225
225
|
}
|
|
226
226
|
if (jsonSchema.enum.every((x) => typeof x === "string")) {
|
|
227
|
-
return
|
|
227
|
+
return import_v37.z.enum(jsonSchema.enum);
|
|
228
228
|
}
|
|
229
|
-
return
|
|
230
|
-
jsonSchema.enum.map((x) =>
|
|
229
|
+
return import_v37.z.union(
|
|
230
|
+
jsonSchema.enum.map((x) => import_v37.z.literal(x))
|
|
231
231
|
);
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
// src/parsers/parse-if-then-else.ts
|
|
235
|
-
var
|
|
235
|
+
var import_v38 = require("zod/v3");
|
|
236
236
|
var parseIfThenElse = (jsonSchema, refs) => {
|
|
237
237
|
const $if = parseSchema(jsonSchema.if, { ...refs, path: [...refs.path, "if"] });
|
|
238
238
|
const $then = parseSchema(jsonSchema.then, {
|
|
@@ -243,7 +243,7 @@ var parseIfThenElse = (jsonSchema, refs) => {
|
|
|
243
243
|
...refs,
|
|
244
244
|
path: [...refs.path, "else"]
|
|
245
245
|
});
|
|
246
|
-
return
|
|
246
|
+
return import_v38.z.union([$then, $else]).superRefine((value, ctx) => {
|
|
247
247
|
const result = $if.safeParse(value).success ? $then.safeParse(value) : $else.safeParse(value);
|
|
248
248
|
if (!result.success) {
|
|
249
249
|
result.error.errors.forEach((error) => ctx.addIssue(error));
|
|
@@ -252,17 +252,17 @@ var parseIfThenElse = (jsonSchema, refs) => {
|
|
|
252
252
|
};
|
|
253
253
|
|
|
254
254
|
// src/parsers/parse-multiple-type.ts
|
|
255
|
-
var
|
|
255
|
+
var import_v39 = require("zod/v3");
|
|
256
256
|
var parseMultipleType = (jsonSchema, refs) => {
|
|
257
|
-
return
|
|
257
|
+
return import_v39.z.union(
|
|
258
258
|
jsonSchema.type.map((type) => parseSchema({ ...jsonSchema, type }, refs))
|
|
259
259
|
);
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
// src/parsers/parse-not.ts
|
|
263
|
-
var
|
|
263
|
+
var import_v310 = require("zod/v3");
|
|
264
264
|
var parseNot = (jsonSchema, refs) => {
|
|
265
|
-
return
|
|
265
|
+
return import_v310.z.any().refine(
|
|
266
266
|
(value) => !parseSchema(jsonSchema.not, {
|
|
267
267
|
...refs,
|
|
268
268
|
path: [...refs.path, "not"]
|
|
@@ -272,9 +272,9 @@ var parseNot = (jsonSchema, refs) => {
|
|
|
272
272
|
};
|
|
273
273
|
|
|
274
274
|
// src/parsers/parse-null.ts
|
|
275
|
-
var
|
|
275
|
+
var import_v311 = require("zod/v3");
|
|
276
276
|
var parseNull = (_jsonSchema) => {
|
|
277
|
-
return
|
|
277
|
+
return import_v311.z.null();
|
|
278
278
|
};
|
|
279
279
|
|
|
280
280
|
// src/utils/omit.ts
|
|
@@ -294,9 +294,9 @@ var parseNullable = (jsonSchema, refs) => {
|
|
|
294
294
|
};
|
|
295
295
|
|
|
296
296
|
// src/parsers/parse-number.ts
|
|
297
|
-
var
|
|
297
|
+
var import_v312 = require("zod/v3");
|
|
298
298
|
var parseNumber = (jsonSchema) => {
|
|
299
|
-
let zodSchema =
|
|
299
|
+
let zodSchema = import_v312.z.number();
|
|
300
300
|
let isInteger = false;
|
|
301
301
|
if (jsonSchema.type === "integer") {
|
|
302
302
|
isInteger = true;
|
|
@@ -395,13 +395,13 @@ var parseNumber = (jsonSchema) => {
|
|
|
395
395
|
};
|
|
396
396
|
|
|
397
397
|
// src/parsers/parse-object.ts
|
|
398
|
-
var z14 = __toESM(require("zod"), 1);
|
|
398
|
+
var z14 = __toESM(require("zod/v3"), 1);
|
|
399
399
|
|
|
400
400
|
// src/parsers/parse-one-of.ts
|
|
401
|
-
var
|
|
401
|
+
var import_v313 = require("zod/v3");
|
|
402
402
|
var parseOneOf = (jsonSchema, refs) => {
|
|
403
403
|
if (!jsonSchema.oneOf.length) {
|
|
404
|
-
return
|
|
404
|
+
return import_v313.z.any();
|
|
405
405
|
}
|
|
406
406
|
if (jsonSchema.oneOf.length === 1) {
|
|
407
407
|
return parseSchema(jsonSchema.oneOf[0], {
|
|
@@ -409,7 +409,7 @@ var parseOneOf = (jsonSchema, refs) => {
|
|
|
409
409
|
path: [...refs.path, "oneOf", 0]
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
|
-
return
|
|
412
|
+
return import_v313.z.any().superRefine((x, ctx) => {
|
|
413
413
|
const schemas = jsonSchema.oneOf.map(
|
|
414
414
|
(schema, i) => parseSchema(schema, {
|
|
415
415
|
...refs,
|
|
@@ -434,7 +434,7 @@ var parseOneOf = (jsonSchema, refs) => {
|
|
|
434
434
|
// src/parsers/parse-object.ts
|
|
435
435
|
function parseObjectProperties(objectSchema, refs) {
|
|
436
436
|
if (!objectSchema.properties) {
|
|
437
|
-
return
|
|
437
|
+
return z14.object({});
|
|
438
438
|
}
|
|
439
439
|
const propertyKeys = Object.keys(objectSchema.properties);
|
|
440
440
|
if (propertyKeys.length === 0) {
|
|
@@ -479,6 +479,7 @@ function parseObject(objectSchema, refs) {
|
|
|
479
479
|
...refs,
|
|
480
480
|
path: [...refs.path, "additionalProperties"]
|
|
481
481
|
}) : void 0;
|
|
482
|
+
const isAdditionalPropertiesTrue = objectSchema.additionalProperties === true;
|
|
482
483
|
if (objectSchema.patternProperties) {
|
|
483
484
|
const parsedPatternProperties = Object.fromEntries(
|
|
484
485
|
Object.entries(objectSchema.patternProperties).map(([key, value]) => {
|
|
@@ -559,24 +560,27 @@ function parseObject(objectSchema, refs) {
|
|
|
559
560
|
} else if (additionalProperties) {
|
|
560
561
|
if (additionalProperties instanceof z14.ZodNever) {
|
|
561
562
|
output = propertiesSchema.strict();
|
|
563
|
+
} else if (isAdditionalPropertiesTrue) {
|
|
564
|
+
output = propertiesSchema.passthrough();
|
|
562
565
|
} else {
|
|
563
|
-
|
|
564
|
-
if (isEmptyObject) {
|
|
565
|
-
output = propertiesSchema.passthrough();
|
|
566
|
-
} else {
|
|
567
|
-
output = propertiesSchema.catchall(additionalProperties);
|
|
568
|
-
}
|
|
566
|
+
output = propertiesSchema.catchall(additionalProperties);
|
|
569
567
|
}
|
|
570
568
|
} else {
|
|
571
|
-
output = propertiesSchema.
|
|
569
|
+
output = propertiesSchema.strict();
|
|
572
570
|
}
|
|
573
571
|
} else {
|
|
574
572
|
if (hasPatternProperties) {
|
|
575
573
|
output = zodSchema;
|
|
576
574
|
} else if (additionalProperties) {
|
|
577
|
-
|
|
575
|
+
if (additionalProperties instanceof z14.ZodNever) {
|
|
576
|
+
output = z14.object({}).strict();
|
|
577
|
+
} else if (isAdditionalPropertiesTrue) {
|
|
578
|
+
output = z14.object({}).passthrough();
|
|
579
|
+
} else {
|
|
580
|
+
output = z14.record(additionalProperties);
|
|
581
|
+
}
|
|
578
582
|
} else {
|
|
579
|
-
output = z14.object({});
|
|
583
|
+
output = z14.object({}).passthrough();
|
|
580
584
|
}
|
|
581
585
|
}
|
|
582
586
|
if (its.an.anyOf(objectSchema)) {
|
|
@@ -622,9 +626,9 @@ function parseObject(objectSchema, refs) {
|
|
|
622
626
|
}
|
|
623
627
|
|
|
624
628
|
// src/parsers/parse-string.ts
|
|
625
|
-
var
|
|
629
|
+
var import_v314 = require("zod/v3");
|
|
626
630
|
var parseString = (jsonSchema) => {
|
|
627
|
-
let zodSchema =
|
|
631
|
+
let zodSchema = import_v314.z.string();
|
|
628
632
|
zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, "format", (zs, format, errorMsg) => {
|
|
629
633
|
switch (format) {
|
|
630
634
|
case "email":
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/parsers/parse-schema.ts
|
|
2
|
-
import * as z16 from "zod";
|
|
2
|
+
import * as z16 from "zod/v3";
|
|
3
3
|
|
|
4
4
|
// src/parsers/parse-all-of.ts
|
|
5
|
-
import { z } from "zod";
|
|
5
|
+
import { z } from "zod/v3";
|
|
6
6
|
|
|
7
7
|
// src/utils/half.ts
|
|
8
8
|
var half = (arr) => {
|
|
@@ -41,7 +41,7 @@ function parseAllOf(jsonSchema, refs) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// src/parsers/parse-any-of.ts
|
|
44
|
-
import { z as z2 } from "zod";
|
|
44
|
+
import { z as z2 } from "zod/v3";
|
|
45
45
|
var parseAnyOf = (jsonSchema, refs) => {
|
|
46
46
|
return jsonSchema.anyOf.length ? jsonSchema.anyOf.length === 1 ? parseSchema(jsonSchema.anyOf[0], {
|
|
47
47
|
...refs,
|
|
@@ -54,7 +54,7 @@ var parseAnyOf = (jsonSchema, refs) => {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
// src/parsers/parse-array.ts
|
|
57
|
-
import { z as z3 } from "zod";
|
|
57
|
+
import { z as z3 } from "zod/v3";
|
|
58
58
|
|
|
59
59
|
// src/utils/extend-schema.ts
|
|
60
60
|
function extendSchemaWithMessage(zodSchema, jsonSchema, key, extend) {
|
|
@@ -161,25 +161,25 @@ var parseArray = (jsonSchema, refs) => {
|
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
// src/parsers/parse-boolean.ts
|
|
164
|
-
import { z as z4 } from "zod";
|
|
164
|
+
import { z as z4 } from "zod/v3";
|
|
165
165
|
var parseBoolean = (_jsonSchema) => {
|
|
166
166
|
return z4.boolean();
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
// src/parsers/parse-const.ts
|
|
170
|
-
import { z as z5 } from "zod";
|
|
170
|
+
import { z as z5 } from "zod/v3";
|
|
171
171
|
var parseConst = (jsonSchema) => {
|
|
172
172
|
return z5.literal(jsonSchema.const);
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
// src/parsers/parse-default.ts
|
|
176
|
-
import { z as z6 } from "zod";
|
|
176
|
+
import { z as z6 } from "zod/v3";
|
|
177
177
|
var parseDefault = (_jsonSchema) => {
|
|
178
178
|
return z6.any();
|
|
179
179
|
};
|
|
180
180
|
|
|
181
181
|
// src/parsers/parse-enum.ts
|
|
182
|
-
import { z as z7 } from "zod";
|
|
182
|
+
import { z as z7 } from "zod/v3";
|
|
183
183
|
var parseEnum = (jsonSchema) => {
|
|
184
184
|
if (jsonSchema.enum.length === 0) {
|
|
185
185
|
return z7.never();
|
|
@@ -196,7 +196,7 @@ var parseEnum = (jsonSchema) => {
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
// src/parsers/parse-if-then-else.ts
|
|
199
|
-
import { z as z8 } from "zod";
|
|
199
|
+
import { z as z8 } from "zod/v3";
|
|
200
200
|
var parseIfThenElse = (jsonSchema, refs) => {
|
|
201
201
|
const $if = parseSchema(jsonSchema.if, { ...refs, path: [...refs.path, "if"] });
|
|
202
202
|
const $then = parseSchema(jsonSchema.then, {
|
|
@@ -216,7 +216,7 @@ var parseIfThenElse = (jsonSchema, refs) => {
|
|
|
216
216
|
};
|
|
217
217
|
|
|
218
218
|
// src/parsers/parse-multiple-type.ts
|
|
219
|
-
import { z as z9 } from "zod";
|
|
219
|
+
import { z as z9 } from "zod/v3";
|
|
220
220
|
var parseMultipleType = (jsonSchema, refs) => {
|
|
221
221
|
return z9.union(
|
|
222
222
|
jsonSchema.type.map((type) => parseSchema({ ...jsonSchema, type }, refs))
|
|
@@ -224,7 +224,7 @@ var parseMultipleType = (jsonSchema, refs) => {
|
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
// src/parsers/parse-not.ts
|
|
227
|
-
import { z as z10 } from "zod";
|
|
227
|
+
import { z as z10 } from "zod/v3";
|
|
228
228
|
var parseNot = (jsonSchema, refs) => {
|
|
229
229
|
return z10.any().refine(
|
|
230
230
|
(value) => !parseSchema(jsonSchema.not, {
|
|
@@ -236,7 +236,7 @@ var parseNot = (jsonSchema, refs) => {
|
|
|
236
236
|
};
|
|
237
237
|
|
|
238
238
|
// src/parsers/parse-null.ts
|
|
239
|
-
import { z as z11 } from "zod";
|
|
239
|
+
import { z as z11 } from "zod/v3";
|
|
240
240
|
var parseNull = (_jsonSchema) => {
|
|
241
241
|
return z11.null();
|
|
242
242
|
};
|
|
@@ -258,7 +258,7 @@ var parseNullable = (jsonSchema, refs) => {
|
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
// src/parsers/parse-number.ts
|
|
261
|
-
import { z as z12 } from "zod";
|
|
261
|
+
import { z as z12 } from "zod/v3";
|
|
262
262
|
var parseNumber = (jsonSchema) => {
|
|
263
263
|
let zodSchema = z12.number();
|
|
264
264
|
let isInteger = false;
|
|
@@ -359,10 +359,10 @@ var parseNumber = (jsonSchema) => {
|
|
|
359
359
|
};
|
|
360
360
|
|
|
361
361
|
// src/parsers/parse-object.ts
|
|
362
|
-
import * as z14 from "zod";
|
|
362
|
+
import * as z14 from "zod/v3";
|
|
363
363
|
|
|
364
364
|
// src/parsers/parse-one-of.ts
|
|
365
|
-
import { z as z13 } from "zod";
|
|
365
|
+
import { z as z13 } from "zod/v3";
|
|
366
366
|
var parseOneOf = (jsonSchema, refs) => {
|
|
367
367
|
if (!jsonSchema.oneOf.length) {
|
|
368
368
|
return z13.any();
|
|
@@ -398,7 +398,7 @@ var parseOneOf = (jsonSchema, refs) => {
|
|
|
398
398
|
// src/parsers/parse-object.ts
|
|
399
399
|
function parseObjectProperties(objectSchema, refs) {
|
|
400
400
|
if (!objectSchema.properties) {
|
|
401
|
-
return
|
|
401
|
+
return z14.object({});
|
|
402
402
|
}
|
|
403
403
|
const propertyKeys = Object.keys(objectSchema.properties);
|
|
404
404
|
if (propertyKeys.length === 0) {
|
|
@@ -443,6 +443,7 @@ function parseObject(objectSchema, refs) {
|
|
|
443
443
|
...refs,
|
|
444
444
|
path: [...refs.path, "additionalProperties"]
|
|
445
445
|
}) : void 0;
|
|
446
|
+
const isAdditionalPropertiesTrue = objectSchema.additionalProperties === true;
|
|
446
447
|
if (objectSchema.patternProperties) {
|
|
447
448
|
const parsedPatternProperties = Object.fromEntries(
|
|
448
449
|
Object.entries(objectSchema.patternProperties).map(([key, value]) => {
|
|
@@ -523,24 +524,27 @@ function parseObject(objectSchema, refs) {
|
|
|
523
524
|
} else if (additionalProperties) {
|
|
524
525
|
if (additionalProperties instanceof z14.ZodNever) {
|
|
525
526
|
output = propertiesSchema.strict();
|
|
527
|
+
} else if (isAdditionalPropertiesTrue) {
|
|
528
|
+
output = propertiesSchema.passthrough();
|
|
526
529
|
} else {
|
|
527
|
-
|
|
528
|
-
if (isEmptyObject) {
|
|
529
|
-
output = propertiesSchema.passthrough();
|
|
530
|
-
} else {
|
|
531
|
-
output = propertiesSchema.catchall(additionalProperties);
|
|
532
|
-
}
|
|
530
|
+
output = propertiesSchema.catchall(additionalProperties);
|
|
533
531
|
}
|
|
534
532
|
} else {
|
|
535
|
-
output = propertiesSchema.
|
|
533
|
+
output = propertiesSchema.strict();
|
|
536
534
|
}
|
|
537
535
|
} else {
|
|
538
536
|
if (hasPatternProperties) {
|
|
539
537
|
output = zodSchema;
|
|
540
538
|
} else if (additionalProperties) {
|
|
541
|
-
|
|
539
|
+
if (additionalProperties instanceof z14.ZodNever) {
|
|
540
|
+
output = z14.object({}).strict();
|
|
541
|
+
} else if (isAdditionalPropertiesTrue) {
|
|
542
|
+
output = z14.object({}).passthrough();
|
|
543
|
+
} else {
|
|
544
|
+
output = z14.record(additionalProperties);
|
|
545
|
+
}
|
|
542
546
|
} else {
|
|
543
|
-
output = z14.object({});
|
|
547
|
+
output = z14.object({}).passthrough();
|
|
544
548
|
}
|
|
545
549
|
}
|
|
546
550
|
if (its.an.anyOf(objectSchema)) {
|
|
@@ -586,7 +590,7 @@ function parseObject(objectSchema, refs) {
|
|
|
586
590
|
}
|
|
587
591
|
|
|
588
592
|
// src/parsers/parse-string.ts
|
|
589
|
-
import { z as z15 } from "zod";
|
|
593
|
+
import { z as z15 } from "zod/v3";
|
|
590
594
|
var parseString = (jsonSchema) => {
|
|
591
595
|
let zodSchema = z15.string();
|
|
592
596
|
zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, "format", (zs, format, errorMsg) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/json-schema-to-zod",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,15 +22,16 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "ISC",
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@types/json-schema": "^7.0.15",
|
|
25
26
|
"@types/node": "^24.0.1",
|
|
26
|
-
"tsup": "^8.
|
|
27
|
-
"typescript": "^5.
|
|
28
|
-
"vitest": "^3.
|
|
29
|
-
"zod-to-json-schema": "^3.24.5"
|
|
27
|
+
"tsup": "^8.5.0",
|
|
28
|
+
"typescript": "^5.9.2",
|
|
29
|
+
"vitest": "^3.2.4",
|
|
30
|
+
"zod-to-json-schema": "^3.24.5",
|
|
31
|
+
"zod": "3.25.76"
|
|
30
32
|
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"zod": "^3.24.2"
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"zod": ">=3.25.76 <5"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
37
|
"clean": "git clean -xdf node_modules",
|