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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.2.0-canary.20250827T070334",
3
+ "version": "4.2.0-canary.20250827T203557",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Colin McDonnell <zod@colinhacks.com>",
@@ -580,7 +580,10 @@ describe("toJSONSchema", () => {
580
580
  });
581
581
 
582
582
  test("nullable openapi-3.0", () => {
583
- expect(z.toJSONSchema(z.string().nullable(), { target: "openapi-3.0" })).toMatchInlineSnapshot(`
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
- expect(z.toJSONSchema(schema, { target: "openapi-3.0" })).toMatchInlineSnapshot(`
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
- expect(z.toJSONSchema(schema, { target: "openapi-3.0" })).toMatchInlineSnapshot(`
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
- expect(z.toJSONSchema(schema, { target: "openapi-3.0" })).toMatchInlineSnapshot(`
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",