zod 4.2.0-canary.20250827T070334 → 4.2.0-canary.20250827T203557
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/package.json
CHANGED
|
@@ -580,7 +580,10 @@ describe("toJSONSchema", () => {
|
|
|
580
580
|
});
|
|
581
581
|
|
|
582
582
|
test("nullable openapi-3.0", () => {
|
|
583
|
-
|
|
583
|
+
const schema = z.string().nullable();
|
|
584
|
+
const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
|
|
585
|
+
validateOpenAPI30Schema(jsonSchema);
|
|
586
|
+
expect(jsonSchema).toMatchInlineSnapshot(`
|
|
584
587
|
{
|
|
585
588
|
"nullable": true,
|
|
586
589
|
"type": "string",
|
|
@@ -590,7 +593,9 @@ describe("toJSONSchema", () => {
|
|
|
590
593
|
|
|
591
594
|
test("union with null openapi-3.0", () => {
|
|
592
595
|
const schema = z.union([z.string(), z.null()]);
|
|
593
|
-
|
|
596
|
+
const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
|
|
597
|
+
validateOpenAPI30Schema(jsonSchema);
|
|
598
|
+
expect(jsonSchema).toMatchInlineSnapshot(`
|
|
594
599
|
{
|
|
595
600
|
"anyOf": [
|
|
596
601
|
{
|
|
@@ -610,7 +615,9 @@ describe("toJSONSchema", () => {
|
|
|
610
615
|
|
|
611
616
|
test("number with exclusive min-max openapi-3.0", () => {
|
|
612
617
|
const schema = z.number().lt(100).gt(1);
|
|
613
|
-
|
|
618
|
+
const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
|
|
619
|
+
validateOpenAPI30Schema(jsonSchema);
|
|
620
|
+
expect(jsonSchema).toMatchInlineSnapshot(`
|
|
614
621
|
{
|
|
615
622
|
"exclusiveMaximum": true,
|
|
616
623
|
"exclusiveMinimum": true,
|
|
@@ -704,7 +711,9 @@ describe("toJSONSchema", () => {
|
|
|
704
711
|
|
|
705
712
|
test("record openapi-3.0", () => {
|
|
706
713
|
const schema = z.record(z.string(), z.boolean());
|
|
707
|
-
|
|
714
|
+
const jsonSchema = z.toJSONSchema(schema, { target: "openapi-3.0" });
|
|
715
|
+
validateOpenAPI30Schema(jsonSchema);
|
|
716
|
+
expect(jsonSchema).toMatchInlineSnapshot(`
|
|
708
717
|
{
|
|
709
718
|
"additionalProperties": {
|
|
710
719
|
"type": "boolean",
|