Skip to content

fixesIssue #2579#2587

Open
Adityakumar37 wants to merge 2 commits intoajv-validator:masterfrom
Adityakumar37:fix-oneof-unevaluated
Open

fixesIssue #2579#2587
Adityakumar37 wants to merge 2 commits intoajv-validator:masterfrom
Adityakumar37:fix-oneof-unevaluated

Conversation

@Adityakumar37
Copy link

What issue does this pull request resolve?

Fixes #2579.

When oneOf is combined with unevaluatedProperties: false, Ajv previously merged evaluation results only from the subschema that validated.
According to Draft 2020-12 §6.5.3.2.2, instance locations processed by an applicator should be considered evaluated regardless of whether that subschema ultimately succeeds.
Because of this, properties handled in failing branches could later be rejected as unevaluated.

What changes did you make?

The oneOf validity rule (exactly one subschema must pass) is unchanged.

This PR updates evaluation propagation so that information from processed subschemas is not lost.
For failing branches, only statically known evaluated properties/items are merged.
Dynamic or universal evaluations (e.g. represented by Name or true) remain gated on schValid, preserving Ajv’s existing scoping expectations and preventing leakage from branches that do not contribute to the result.

I also added a regression test covering the reported scenario.

Is there anything that requires more attention while reviewing?

Evaluation propagation around composite keywords is subtle, especially with dynamic references.

I verified locally that:

  • the reported false negative is resolved,
  • the exactly-one constraint is unaffected,
  • the full test suite remains green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

oneOf incorrectly tracks evaluated properties for unevaluatedProperties (Draft 2020-12)

1 participant