@composio/json-schema-to-zod 0.1.14 → 0.1.15
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 +11 -2
- package/dist/index.js +11 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -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,6 +560,8 @@ 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
566
|
const isEmptyObject = Object.keys(propertiesSchema._def.shape()).length === 0;
|
|
564
567
|
if (isEmptyObject) {
|
|
@@ -574,9 +577,15 @@ function parseObject(objectSchema, refs) {
|
|
|
574
577
|
if (hasPatternProperties) {
|
|
575
578
|
output = zodSchema;
|
|
576
579
|
} else if (additionalProperties) {
|
|
577
|
-
|
|
580
|
+
if (additionalProperties instanceof z14.ZodNever) {
|
|
581
|
+
output = z14.object({}).strict();
|
|
582
|
+
} else if (isAdditionalPropertiesTrue) {
|
|
583
|
+
output = z14.object({}).passthrough();
|
|
584
|
+
} else {
|
|
585
|
+
output = z14.record(additionalProperties);
|
|
586
|
+
}
|
|
578
587
|
} else {
|
|
579
|
-
output = z14.object({});
|
|
588
|
+
output = z14.object({}).passthrough();
|
|
580
589
|
}
|
|
581
590
|
}
|
|
582
591
|
if (its.an.anyOf(objectSchema)) {
|
package/dist/index.js
CHANGED
|
@@ -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,6 +524,8 @@ 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
530
|
const isEmptyObject = Object.keys(propertiesSchema._def.shape()).length === 0;
|
|
528
531
|
if (isEmptyObject) {
|
|
@@ -538,9 +541,15 @@ function parseObject(objectSchema, refs) {
|
|
|
538
541
|
if (hasPatternProperties) {
|
|
539
542
|
output = zodSchema;
|
|
540
543
|
} else if (additionalProperties) {
|
|
541
|
-
|
|
544
|
+
if (additionalProperties instanceof z14.ZodNever) {
|
|
545
|
+
output = z14.object({}).strict();
|
|
546
|
+
} else if (isAdditionalPropertiesTrue) {
|
|
547
|
+
output = z14.object({}).passthrough();
|
|
548
|
+
} else {
|
|
549
|
+
output = z14.record(additionalProperties);
|
|
550
|
+
}
|
|
542
551
|
} else {
|
|
543
|
-
output = z14.object({});
|
|
552
|
+
output = z14.object({}).passthrough();
|
|
544
553
|
}
|
|
545
554
|
}
|
|
546
555
|
if (its.an.anyOf(objectSchema)) {
|