Skip to content

fix: do not treat annotations as branch failures - #130

Merged
sagold merged 1 commit into
sagold:mainfrom
fitchmultz:fix/annotation-aware-branches
Oct 18, 2026
Merged

sagold merged 1 commit into
sagold:mainfrom
fitchmultz:fix/annotation-aware-branches

Conversation

@fitchmultz

@fitchmultz fitchmultz commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #128.

When a subschema only produces annotations, such as deprecated, the branch checks count it as a failure. As a result, oneOf rejects valid data, if falls through to else, and not accepts data it should reject.

These checks now treat a branch as passing when everything it returns is an annotation (isJsonAnnotation), instead of expecting an empty result. A pending async result still counts as a non-match, same as before. That covers:

  • oneOf and anyOf validation and reduction
  • the oneOf declarator and fuzzy matching
  • if and not
  • contains and propertyNames
  • the unevaluated checks

Annotation handling is otherwise unchanged.

Tests are in src/tests/issues/issue128.branch-annotations.test.ts. The JSON pointer escaping that used to be in this PR is now in #131.

AI disclosure: This pull request was prepared with AI assistance and reviewed by me.

@sagold

sagold commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Hi Mitch,

thank you so much for your contribution!

I will review and integrate your MR next. It might take some time though as I have not much to spare and there a lot of changes.

Best,
Sascha

@fitchmultz
fitchmultz force-pushed the fix/annotation-aware-branches branch from 4c65acb to bf1f760 Compare October 14, 2026 02:19
@fitchmultz fitchmultz changed the title fix: preserve JSON pointers and distinguish branch annotations from errors fix: do not treat annotations as branch failures Oct 14, 2026
@sagold
sagold merged commit ec166f3 into sagold:main Oct 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oneOf rejects a branch that carries the deprecated annotation

2 participants