Commit a5a7a7b
committed
fix(docs): the schema-extension FAQ rotted in reverse — pin the claim in the checked block this time
#3890 taught that FieldSchema/ObjectSchema/ActionSchema are ZodPipes and that
FieldSchema.extend throws. True when written; protocol 17 (#3855, acbf364)
then retired the aliases whose lowering was the whole reason for the
field/object transforms, the pipes collapsed to plain ZodObjects, and both
prose claims inverted within days: .extend works, and the recommended
FieldSchema.in is now undefined — following the FAQ was once again the only
way to hit an error. Only ActionSchema (requiresFeature -> visible lowering,
still live per the ledger) remains a pipe. All verified against a clean build:
FieldSchema bound ZodObject .extend: function .in: undefined
ObjectSchema bound ZodObject .extend: function .in: undefined
ActionSchema bound ZodPipe .extend: undefined .in: ZodObject
The example gate never noticed because #3890's checked block used only
.parse() — deliberately shape-agnostic after CI rejected the .in.extend
attempt. That made the code durable and left the PROSE as the only
load-bearing surface, which is exactly where the rot settled.
The rewrite moves the claim into the checked block: it calls
FieldSchema.extend({ ... }) directly, so a future shape flip fails CI loudly
instead of the prose going quietly wrong. Composition stays as the
shape-agnostic default; ActionSchema is the documented pipe case; and the FAQ
teaches the one-line probe (typeof SomeSchema.extend === 'function') instead
of a table of shapes that history says will not stay true.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ajwvrmd1hDC9RBofYBhGuR1 parent ff17642 commit a5a7a7b
2 files changed
Lines changed: 52 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
375 | 372 | | |
376 | 373 | | |
377 | 374 | | |
378 | 375 | | |
379 | 376 | | |
380 | 377 | | |
381 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
382 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
383 | 389 | | |
384 | 390 | | |
385 | 391 | | |
386 | | - | |
387 | 392 | | |
388 | 393 | | |
389 | 394 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
395 | 405 | | |
396 | 406 | | |
397 | 407 | | |
| |||
0 commit comments