Open jamesbmorris92 opened 2 weeks ago
Hi @jamesbmorris92, just to help me investigate, could you setup an example of this in runkit?
Hi @jasoniangreen here's an example: https://runkit.com/jamesbmorris92/6682b96af2a88c000808ae0e
Hi @jasoniangreen here's an example: https://runkit.com/jamesbmorris92/6682b96af2a88c000808ae0e
Thanks @jamesbmorris92, I will look into this, but in the meantime, I have a question. It's quite a complex / deeply nested example, do you think the example can be simplified further while still exhibiting the problem?
@jasoniangreen my apologies, i've made the example a bit more simple with less nesting: https://runkit.com/jamesbmorris92/6682b96af2a88c000808ae0e
hi @jasoniangreen were you able to recreate the issue?
I can see what you report, I've just got to dig more into the docs to understand what should be expected. There are a lot of cases in AJV and JSON Schema where you will legitimately get more errors than you expect, I'm just trying to understand if this is one of those situations.
Ah @jamesbmorris92 if you remove the allErrors: true
option, it get's the expected result of just the contains error. Does this solve your issue? All errors true means that AJV will continue to check your data after encountering the first error, which seems to be the case here.
What version of Ajv are you using? Does the issue happen if you use the latest version? "version": "8.12.0",
Ajv options object
JSON Schema
Sample data
Your code
Validation result, data AFTER validation, error messages
What results did you expect? I got three errors where I expected just one. I expected the third error as a result of using contains with maxContains and minContains because I had more than one row of test data where lastUpdatedAtTime: true. However I didn't expect the first two errors that say the lastUpdatedAtTime must be equal to constant and the only permitted value is true.
Are you going to resolve the issue? I would like to but i'm not sure how. Apologies if i've made any mistakes or missed anything above this is my first issue submission.