Commit 19c5b62
committed
fix(core-internal): null-tolerant array/tuple elements; quiet never verdicts; annotation-safe oneOf rewrite
- Array/tuple ELEMENT positions: JSON.stringify turns an undefined
element into null (unlike an undefined-valued object key, which it
drops), so a tolerant element (.default()/.prefault(), ...) may ship
as null while the advertised items/prefixItems subschema rejected it
— z.array(z.number().default(0)) output rejected the wire form
[1, null, 3]. The override now wraps such emitted subschemas as
{anyOf: [original, {type: 'null'}]} (loosen-only), mirroring how the
catch degrade already behaves at the same position.
- z.never() union members yielded undefined verdicts and defeated the
every-member rule: z.union([z.never(), z.bigint()]) threw pre-#2464
but listed as a phantom. never now returns a QUIET non-object verdict
(it matches no value, so it can never make a union satisfiable or
object-shaped) — loud co-members restore the pre-#2464 throw while
bare never, never+never, and never+representable shapes keep listing
exactly as they did pre-#2464 (never is deliberately NOT in the loud
set).
- rewriteOneOfToAnyOf walked blindly into annotation VALUES via
Object.values, renaming a literal user-data oneOf key inside
default/examples (advertised default: {oneOf: [1,2]} became
{anyOf: [1,2]}). The walk now skips ANNOTATION_JSON_SCHEMA_KEYWORDS
plus const/enum/x-* values, mirroring the catch-degrade loop's
annotation carve-out.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent faef197 commit 19c5b62
2 files changed
Lines changed: 81 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
293 | 319 | | |
294 | 320 | | |
295 | 321 | | |
| |||
331 | 357 | | |
332 | 358 | | |
333 | 359 | | |
334 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
335 | 367 | | |
336 | 368 | | |
337 | 369 | | |
| |||
683 | 715 | | |
684 | 716 | | |
685 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
686 | 726 | | |
687 | 727 | | |
688 | 728 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
448 | 488 | | |
449 | 489 | | |
450 | 490 | | |
| |||
0 commit comments