-
-
Notifications
You must be signed in to change notification settings - Fork 590
on validation error, path to wrong item is false when "anyOf" is used #360
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
Comments
Note that when the schema is written without "anyOf", then the error and its path are perfectly reported. |
Hi. I'm not sure I fully follow what you're calling the bug, but I think you're just referring to the fact that Please have a look at http://python-jsonschema.readthedocs.io/en/latest/errors/#best-match-and-relevance though, which do try to guess which error you probably want to see. |
Hi. Unfortunately the "best match" cannot help, as I only get 1 error. The error message seems actually to be OK, und unfortunately not very helpful. In the example (data.json), there is a string of length 13 ("chapter_55555"), although the schema imposes a maxLength of 10. ... which clearly reports the error, even if there are many other errors (noise) reported concerning "anyOf". But jsonschema does not report at all somethings related to the string "chapter_555555" being to long. Sincerely, xjlm |
Still not quite sure what you mean, did you read that doc page? |
Hi, Yes, you're perfectly right, I did not try "best_match" ... sorry. ERROR u'chapter_55555' is too long *** deque([u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'TITLE']) But unfortunately I've just try this 'best_match' with an other schema (with an "anyOf" containing 2 items) and another json data, and the error message seems NOT to be OK to be:
ERROR u'DATA' is not one of [u'CHAPTER'] *** deque([u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'TYPE']) I am waiting: ERROR u'data_5555555' is too long *** deque([u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'TITLE']) What do you think about it ? Sincerely, xjlm PS: check.py, data.json and schema.json in BUG_VALIDATION2.zip |
Sounds like your data has multiple errors then, or that it has one error on
each branch of the anyOf, so you're getting the error from the other branch
which is equally "wrong".
Unfortunately I can't really spend much time helping you troubleshoot,
there's an IRC channel and a mailing list if you need some help, but unless
you think there's a bug or some missing functionality I'm not sure I can do
anything more here, my guess is that you just need to have another look at
the documentation and play a bit with what exists?
On Sep 15, 2017 9:45 AM, "xjlm" <[email protected]> wrote:
Hi,
Yes, you're perfectly right, I did not try "best_match" ... sorry.
So now I get as you said this error message:
ERROR u'chapter_55555' is too long *** deque([u'CONTENT', 0, u'CONTENT', 0,
u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'TITLE'])
But unfortunately I've just try this 'best_match' with an other schema
(with an "anyOf" containing 2 items) and another json data, and the error
message seems NOT to be OK to be:
python check.py
ERROR u'DATA' is not one of [u'CHAPTER'] *** deque([u'CONTENT', 0,
u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'TYPE'])
I am waiting:
ERROR u'data_5555555' is too long *** deque([u'CONTENT', 0, u'CONTENT', 0,
u'CONTENT', 0, u'CONTENT', 0, u'CONTENT', 0, u'TITLE'])
What do you think about it ?
Sincerely,
xjlm
PS: check.py, data.json and schema.json in BUG_VALIDATION2.zip
PPS: please feel free to close the ticket if you think I am wrong
BUG_VALIDATION2.zip
<https://github.com/Julian/jsonschema/files/1306521/BUG_VALIDATION2.zip>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#360 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAUIXlVZDHTuNK-DRxlr1-GVcMUUui0Yks5sin99gaJpZM4PVwPB>
.
|
closed because it may be an user error |
86f52b87 Fix a clear copy-paste error in the case names for tests from #394. ec18a7d0 Merge pull request #360 from notEthan/duplicate_uris cd9a4b9d change schemas with duplicate URIs http://localhost:1234/folder/ 43e190e0 Merge pull request #394 from rjmill/rjmill/bools-and-1s-and-0s-inside-objects-and-arrays 85f0d459 Merge pull request #419 from ChALkeR/chalker/format-uri 54436216 Merge pull request #420 from ChALkeR/chalker/format/ip6 ad47b726 Add long valid and invalid ipv6 b2ab70ec More optional ipv6 tests 37189ae6 Test that uri format scheme is validated for allowed chars 2106ed17 backport uniqueItems cases to draft3 49fc2a95 backport const test cases to draft6 79fe60c0 more tests for true != 1 and false != 0 inside objects/arrays git-subtree-dir: json git-subtree-split: 86f52b87e3d572b8f808dd074a6b95c3695ba992
Hi
when a schema contains a "recursive" structure inside a "anyOf", and there is an error in a related json file deep in the hierarchy, then the validator finds the error but indicates a wrong path:
INFO validate file 'data.json' ...
ERROR validate file 'data.json' FAIL
ERROR {u'CONTENT': [{u'CONTENT': [{u'CONTENT': [{u'TYPE': u'CHAPTER', u'TITLE': u'chapter_55555'}], u'TYPE': u'CHAPTER', u'TITLE': u'chapter_4'}], u'TYPE': u'CHAPTER', u'TITLE': u'chapter_3'}], u'TYPE': u'CHAPTER', u'TITLE': u'chapter_2'} is not valid under any of the given schemas *** deque([u'CONTENT', 0, u'CONTENT', 0])
Note that the online validator https://json-schema-validator.herokuapp.com finds many errors but at least indicates the error concerning the string being too long and its path
see attached files schema.json and data.json
The text was updated successfully, but these errors were encountered: