-
Notifications
You must be signed in to change notification settings - Fork 280
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
Add Schema validation path traceability #256
base: master
Are you sure you want to change the base?
Conversation
Hello @afranzi how is this newly introduced |
Hi @erosb, this is different from the If I understand properly, it seems that the |
Hi @erosb, Using the
As you can see, it returns the schema location, but not the exact path in the event validated where the subschema was matching. Regarding your comment in the issue #255 (comment), which proposal or workaround would you propose to get the correct path? |
Hello @afranzi , thinking through it, regarding both your open issues, I think the best I can advise you is keeping up a permanent fork of the library (at least for the duration of your project), altering it in the way you need to. Then when you are done with your project we will see what added features can we backport into this repository. From my view the situation is that you are using the library for something that it isn't really designed for, and in a way that I don't clearly understand. No doubt it sounds like an awesome research project, but I simply don't have the mental capacity these times to understand it, hence it is hard to advise on design in a forward-thinking way. Thank you for your understanding. |
This PR aims to show a PoC of tracing how the schema is being validated, that means which subschemas are being validated regarding the location of them.
The example from https://gist.github.com/afranzi/76497177ea8bc305c355b49bc3b2f6b0 shows how we are using a complex schema to validate one SensorEvent. After validating we generate the following output:
Then we know that this event was formed by a SensorWifi data inside the
#/data
field and then inside that one the array#/data/scan
contains two elements that validates agains the WifiConnection schema. Knowing which schema validates each item matters if the array of items can contain different types of subschemas.I'm not really proud of this solution by passing all the paths through the
accept
andvalidate
methods. So I would be open to any advice, proposal, idea, best practise to improve it.What do you think @erosb? You can see in the Gist how are we using the
ValidationListener
.Thanks,
Regards,