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
StringsSchema has not implemented 'not'. #116
Comments
This fix will clear the issue that I got when using "not" blocks for validation of string. Example would be to add forbidden values (not enum) or anti-patterns (not pattern). Implementation should be quite straight forwards, and be implementing "not" as a complete schema of its own - using the existing "NotSchema" class to validate the schema.
Hello @kazie , first, if you rewrite the schema to this form, then it will work:
Second, please don't fix it as-is. The library makes the false assumption that the keywords are / can be "grouped" in a specific type-related way. When the schema gets loaded, the loader makes some investigation about the possible type of the schema, then it loads the schema by taking only the schema-specific keywords into account. In your case, when the loader finds This has been the most common reason why issues are raised for this library, so probably it would make sense to attempt to fix it. The best thing I can imagine is
In other words the plan is to do the same rewrite automatically that I showed an example of above. I would welcome any efforts to it. Otherwise I'm not sure if I will find time to fix it before the end of year. Of course it affects fundamental parts of the library so this change should be tested thoroughly. If you have any further questions on it then please don't hesitate to ask. |
Thank you for your through comment @erosb. I can confirm that this also works good in my other project which is using multiple different json parsers, and that no other ones disliked the Too bad to hear that this is a common issue! Best Regards, |
Whoever it might concern.
While using the latest Everit Json-schema validator, I happen to notice that it didn't let me run though on strings where I had implemented "not enum" blocks, or other "not" blocks for that matter.
Examples Schema:
Didn't invalidate
Didn't invalidate:
As one can test one self, should be valid in other validators, such as the online validator on:
https://jsonschemalint.com/#/version/draft-06/markup/json
I will soon propose suggested fix, which also validates the changes by:
Please if any comments, you can either "fix-it-yourself" or tell me if I need some changes in the code for a proposed pull request that will come with this ticket.
Best Regards,
The text was updated successfully, but these errors were encountered: