-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
KeyError with nested patternProperties #28
Comments
Doing some more digging with this. Turned out I was still on 1.6. Now on 2.3. The test case above no longer fails for me but I'm still getting the same sort of error on slightly more complex cases. I'll try and put together a new test case. |
I don't have much more useful info yet, but it does seem that the problem is non-deterministic. Running the same time multiple times results in different key errors (in the example above, they would be with keys at the baz/bit level) or occasionally results in the document validating successfully... |
Any chance someone could take a look at this? |
Just discovered a bug related to this by using your example schema and data and debugging into the generated code (using compile_to_code). The key error is reproducable for me. The issue seems to be Also looking at the way this is built, I'm not sure that similiar issues can not be forced when it comes to nested properties with the same property names. Fully classifying all variables based on the properties would fix this. e.g. data.item.foo.bar_value, data.item.foo.bar_key |
I plan to look at it tomorrow. |
Okay, my first naive idea was to use something like: I'll let you look into it @horejsek . If you have any questions about what I found out, let me know. When debugging the generated code using the example from this issue, the problem becomes clear quite quickly. |
Thanks @FrederikP, you found the bug. :-) The same problem was on more places. It's fixed in master. I plan to do more stuff tomorrow, do you want to release it today or can you wait till tomorrow, @j616? |
I can wait until tomorrow. For now it's useful to know I don't have to find a work around and to know I'm not doing anything silly on my end! Thanks. |
When an object using patternProperties is further down the tree than another patternProperties field you get a KeyError.
Example schema:-
Example document to validate against it :-
This results in :-
The following schema where the second patternProperties is replaced with a regular properties validates correctly:-
The following where the first patterProperties is replaced also validates correctly:-
The text was updated successfully, but these errors were encountered: