-
Notifications
You must be signed in to change notification settings - Fork 325
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
Walk in ItemsValidator202012 uses different path than ItemValidator #989
Comments
So in general passing If you are referring to json-schema-validator/src/main/java/com/networknt/schema/ItemsValidator202012.java Lines 134 to 137 in bc93b44
ArrayNode as opposed to handling when it's null. So it could be that ItemsValidator should be changed to make it consistent but I'm hesitant to make any changes without knowing whether the actual use case is valid since you mentioned that the instance is null and not that the ArrayNode doesn't have children.
|
My use case is to walk the schema for different purposes than validation - I know this is not the main use case for your library :) I have created a minimal use case I was trying to explain above: https://gist.github.com/bartoszm/5bdcebe01c59742ad40165c1a78a8966 What the use case demonstrates is how the walk works when data instance is provided and when data is not provided. The result for The result for |
As I highlighted, the walk is walking the instance data, it doesn't walk the schema, so passing If there's anything to fix it would be to make the V202012 processing to be the same as the processing with V201909. Would this solve your issue, because it sounds like what you want is the opposite. |
@justin-tay having the V202012 processing to be the same as the processing with V201909 would solve my issue. |
Just to confirm as maybe this difference is intentional.
When you perform walk with
null
instance the behavior differs between(1) com.networknt.schema.ItemsValidator
(2) com.networknt.schema.ItemsValidator202012
(1) appends 0 to the instance path whereas (2) does not.
In addition (2) addends id in case instance is not null and does not otherwise.
Simple fix is to add index
0
com.networknt.schema.ItemsValidator202012:135 either unconditionally or in casenode
isnull
.Please let me know your thoughts on this. I am able to provide fix if you confirm difference in behavior is unintentional.
The text was updated successfully, but these errors were encountered: