Commit 72a05c4
authored
feat(v4): expose stringbool truthy/falsy/case via _zod.bag (#6357)
`z.stringbool()` builds a `$ZodCodec` whose transform closes over the
resolved `truthy`/`falsy` values, so nothing could read them back off the
schema. Introspection tools were regexing `transform.toString()` just to
detect a stringbool, and the values stayed out of reach either way.
The resolved config now lands on `._zod.bag` after construction, the same
way `z.instanceof` exposes `bag.Class`. The stored arrays are the
normalized ones — lowercased unless `case: "sensitive"` — so they match
what the codec actually accepts, and `truthy[0]`/`falsy[0]` are what it
encodes back to.
Requested in #5011.1 parent 036b39f commit 72a05c4
3 files changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
1831 | 1835 | | |
1832 | 1836 | | |
1833 | 1837 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
| 915 | + | |
| 916 | + | |
915 | 917 | | |
916 | 918 | | |
917 | 919 | | |
918 | 920 | | |
919 | 921 | | |
920 | 922 | | |
| 923 | + | |
921 | 924 | | |
922 | 925 | | |
923 | 926 | | |
| |||
0 commit comments