Add Schema validation path traceability #256
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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,