Test case
1 generated file · +1 −1test/inputs/schema/optional-constraints.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -4,7 +4,7 @@ import * as z from "zod"; | ||
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | 5 | "optDouble": z.number().optional(), |
| 6 | 6 | "optInt": z.number().int().optional(), |
| 7 | - "optPattern": z.string().optional(), | |
| 7 | + "optPattern": z.string().regex(new RegExp("^[a-z]+$")).optional(), | |
| 8 | 8 | "optString": z.string().optional(), |
| 9 | 9 | "reqZeroMin": z.number().int(), |
| 10 | 10 | }); |
Test case
1 generated file · +3 −3test/inputs/schema/pattern.schema
Mschema-typescript-zoddefault / TopLevel.ts+3 −3
| @@ -2,8 +2,8 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "pattern1": z.string(), | |
| 6 | - "pattern2": z.string(), | |
| 7 | - "union": z.string(), | |
| 5 | + "pattern1": z.string().regex(new RegExp("a[.]*")), | |
| 6 | + "pattern2": z.string().regex(new RegExp("b[.]*")), | |
| 7 | + "union": z.string().regex(new RegExp("(b[.]*)|(c[.]*)")), | |
| 8 | 8 | }); |
| 9 | 9 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/renaming-bug.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -107,7 +107,7 @@ export const FruitSchema = z.object({ | ||
| 107 | 107 | export type Fruit = z.infer<typeof FruitSchema>; |
| 108 | 108 | |
| 109 | 109 | export const TopLevelSchema = z.object({ |
| 110 | - "version": z.string().optional(), | |
| 110 | + "version": z.string().regex(new RegExp("^\\d{1,5}.{1}\\d{1,5}.{1}\\d{1,5}$")).optional(), | |
| 111 | 111 | "fruits": z.array(FruitSchema).optional(), |
| 112 | 112 | "vehicles": z.array(VehicleSchema).optional(), |
| 113 | 113 | }); |
No generated files match these filters.