You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the large refactor of paths by @justin-tay , being fairly neophytish in my understanding of JsonSchema and many of the objects therein, my code broke. Basically I used validationMessage.getPath() in two places
An informational message. There I suspect the normal toString of the new path object will be fine
I adapted a helpful post by one of the users of this library earlier to determine the line at which the violation caused in the original YAML. The code that broke was
JsonNode findJsonNode(ValidationMessage msg, JsonNode rootNode) {
// Construct the JSONPointer.
JsonPointer pathPtr = JsonPointer.valueOf(msg.getPath());
// Now see if we can find the node.
return rootNode.at(pathPtr);
}
LocationDetails getLocationDetails(ValidationMessage msg, JsonNode rootNode) {
LocationDetails retval = null;
JsonNode node = findJsonNode(msg, rootNode);
if (node instanceof LocationProvider) {
retval = ((LocationProvider) node).getLocationDetails();
}
return retval == null ? LocationDetails.EMPTY : retval;
}
The code breaks because JsonPointer requires a string here. I've given additional context here, and can provide more
I'm not sure how to adjust this, and would appreciate assistance
The text was updated successfully, but these errors were encountered:
I'm not really sure if the node is the schema data or the input data.
If it is the schema data you can try the following
JsonNodefindJsonNode(ValidationMessagemsg, JsonNoderootNode) {
// Construct the JSONPointer.JsonPointerpathPtr = JsonPointer.valueOf(msg.getSchemaLocation().getFragment().toString());
// Now see if we can find the node.returnrootNode.at(pathPtr);
}
If it is the input data you can try the following assuming you configured the PathType to PathType.JSON_POINTER as by default it is PathType.JSON_PATH.
JsonNodefindJsonNode(ValidationMessagemsg, JsonNoderootNode) {
// Construct the JSONPointer.JsonPointerpathPtr = JsonPointer.valueOf(msg.getInstanceLocation().toString());
// Now see if we can find the node.returnrootNode.at(pathPtr);
}
After the large refactor of paths by @justin-tay , being fairly neophytish in my understanding of JsonSchema and many of the objects therein, my code broke. Basically I used
validationMessage.getPath()
in two placestoString
of the new path object will be fineThe code breaks because JsonPointer requires a string here. I've given additional context here, and can provide more
I'm not sure how to adjust this, and would appreciate assistance
The text was updated successfully, but these errors were encountered: