Commit f105c75
committed
fix(core-internal): conjunction-preserving oneOf rewrite; skip negated positions
- The oneOf->anyOf rename bailed when the node already carried anyOf
(zod merges .meta({anyOf: [...]}) verbatim), leaving a
reject-everything oneOf after its members were loosened into mutual
satisfiability. Instead of bailing, the loosened members now move
under allOf as {anyOf: members} — keywords on one node combine with
AND, so this is semantically equivalent, loosen-only, and does not
clobber the user's anyOf.
- The walker recursed into not/if, where oneOf->anyOf INVERTS polarity
and tightens: a payload matching >=2 members passed not {oneOf}
pre-#2464 but failed the rewritten not {anyOf} (and under if, the
rename can flip which then/else branch applies). Negated/conditional
positions are now skipped; then/else and the other schema-carrying
keywords are positive-polarity and keep the rewrite.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 8270f46 commit f105c75
2 files changed
Lines changed: 50 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
413 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
414 | 422 | | |
415 | 423 | | |
416 | 424 | | |
| |||
419 | 427 | | |
420 | 428 | | |
421 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
422 | 434 | | |
423 | 435 | | |
424 | 436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
625 | 661 | | |
626 | 662 | | |
627 | 663 | | |
| |||
0 commit comments