Commit d60f9ed
fix(codegen-ts): don't chain string validators onto a required jsonb open-bag
A `field.string` + `@dbColumnType: jsonb` open bag has a `z.unknown()` base (0.14.0).
A REQUIRED such field still got the required-non-empty `.min(1)` chained on, emitting
`z.unknown().min(1)` — a TS compile error (ZodUnknown has no .min), so an adopter's
generated schema stopped compiling after 0.14.0.
appendValidatorChain now skips the string .min/.max/.regex branch for a jsonb open bag
(a jsonb ARRAY still gets element-count bounds via the array branch); "required" for an
open bag means non-optional only, already handled by the optional() logic. Adds a
required-jsonb regression case to jsonb-open-bag-zod.test.ts. Full suite 869 green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DV7ad8tggzcpFJzXYvHwRU1 parent b40f061 commit d60f9ed
3 files changed
Lines changed: 33 additions & 1 deletion
File tree
- server/typescript/packages/codegen-ts
- src/templates
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
10 | 20 | | |
11 | 21 | | |
12 | 22 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
507 | 514 | | |
508 | 515 | | |
509 | 516 | | |
510 | 517 | | |
511 | 518 | | |
512 | | - | |
| 519 | + | |
513 | 520 | | |
514 | 521 | | |
515 | 522 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
71 | 86 | | |
72 | 87 | | |
73 | 88 | | |
| |||
0 commit comments