Repository navigation
Commit 2abc9e0
authored
docs: note that the JSON Schema emitter reads static optin (#6417)
* docs: note that the JSON Schema emitter reads static optin
`objectProcessor` is the one consumer of `optin` that has to read the static
declaration rather than the runtime flag, because `io: "input"` describes the
declared input type. Nothing near the emitter said so, and #6409 and #6133
landed seven minutes apart taking opposite lines on the two halves of that
question: #6409 stripped an output-typed catch value from the input schema
while explicitly leaving requiredness on the runtime flag, and #6133 then had
to rewrite the snapshot #6409 had just added.
Add the emitter to the consumer table in wiki/optionality.md, with a section
covering the split and both halves of it, and point at that section from
inputOptin(). Also drop the stale in-flight branch reference in the header and
the "each with a single consumer" claim, which the optin row already
contradicted.
* docs: scope the uniqueness claim and correct the #6409 description
Two corrections from review.
`objectProcessor` is not the only emitter consumer of `optin`. `tupleProcessor`
reads it in the same input branch to shrink `minItems`, and it reads the runtime
value with no resolution past transform or catch. That is a live divergence, not
just a wording gap:
z.toJSONSchema(z.tuple([z.string(), z.preprocess(v => v, z.string())]), { io: "input" })
// minItems: 1, but z.input<> is [string, string] and .safeParse(["a"]) rejects
Record it rather than assert consistency the emitter does not have. Left unfixed
here to keep this docs-only β the fix touches core/ and needs its own tuple
minItems snapshots.
The #6409 sentence also generalized too far. A plain catch keeps its `default`
under io: "input"; #6409 added catch to isTransforming's recursion, so only a
catch over a transforming schema loses it.
* docs: point the inputOptin comment at the section that documents it
The cross-reference named "Static/runtime divergence", which covers the
parser-level catch/transform/preprocess split and never mentions the emitter.
The section that documents this comment is the one added here.1 parent 578e1cd commit 2abc9e0
2 files changed
Lines changed: 33 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
269 | 272 | | |
270 | 273 | | |
271 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
116 | 143 | | |
117 | 144 | | |
118 | 145 | | |
| |||
0 commit comments