Skip to content

Conversation

@ShivaGupta-14
Copy link
Contributor

Description

When multiple const or enum constraints fail (e.g., via allOf), produce a single message with the most restrictive constraint instead of multiple redundant messages.

  • Compute the intersection of allowed values across all constraints
  • If intersection has 1 value: use const message
  • If intersection has multiple values: use enum message
  • If intersection is empty (contradictory): use boolean schema message
  • Fixes: Combine const and enum handlers #132

Checklist

  • npm test
  • npm run lint
  • npm run type-check

@ShivaGupta-14 ShivaGupta-14 force-pushed the 132-combine-const-enum-handlers branch from 7646a94 to ac73647 Compare January 30, 2026 18:24
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.

This approach isn't going to work. Try,

{
  "allOf": [
    { "const": "a" },
    { "const": "b" }
  ]
}

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.

Combine const and enum handlers

2 participants