Skip to content

Add support for discriminator identification for anyOf #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2025

Conversation

jdesrosiers
Copy link
Collaborator

I figured out a way to identify discriminators by adding nodes in the errorIndex for properties that don't exist in the instance. There's still a lot more to figure out, but this gets us passed one hurdle.

@arpitkuriyal
Copy link
Collaborator

Looks good. Sorry for the delay i got busy with some personal work. I am looking to the all TODO still figuring out how to handle all this case.
Case 1: Handle alternatives with const - In this we can check the type of the const value and generate error message accordingly

 {
  "anyOf": [
    { "const": "READ_ONLY" },
    { "const": 4 }
  ]
}

Like in this if instance: 5 we can simply check the type but what if both alternative type is also same (then only option i can see is to throw error message for each alternative separately)

Each TODOs gets more complex when i think more and more about how to handle it 🙂

@arpitkuriyal arpitkuriyal merged commit 0476c26 into main Aug 15, 2025
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