Skip to content

Conversation

@srivastava-diya
Copy link
Contributor

The issue

Currently, the multipleOf error handler only considers constraints that failed.

If a schema has many multipleOf constraints (e.g in an allOf), such as:

{
  "allOf": [
    { "multipleOf": 2 },
    { "multipleOf": 3 }
  ]
}
instance = 9  //multiple of 3 only

then,

  • multipleOf: 3 PASSES.
  • multipleOf: 2 FAILS.
  • The reported error is: "Expected a number that is a multiple of 2".
Screenshot 2026-02-03 033257

Expected behaviour

since both are required, the user effectively requires a multiple of 6. The error message should reflect the combined constraint, even if one of the individual checks passed.

The Fix

This PR updates multipleOf error-handler to:

  • Iterate over all multipleOf constraints for the given location, regardless of whether they passed or failed.
  • Calculate the LCM of all these constraints.
  • Report an error with the combined LCM value if at least one of the constraints failed.

Verification

Test case has been added to cover this.

Copy link
Collaborator

@jdesrosiers jdesrosiers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! We found that issue in #155, but it didn't occur to me that this could have the same weakness.

@jdesrosiers jdesrosiers merged commit a362ad4 into hyperjump-io:main Feb 3, 2026
1 of 2 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.

2 participants