-
Notifications
You must be signed in to change notification settings - Fork 395
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
access to ProcessingMessage internal map #193
Comments
I now see that missing required properties are handled in one msg, so perhaps ProcessingReport can give list of failed properties? |
Hi @sharonbn1 I think I understand your situation, because few days back I also wanted to request for this map field access. But there's already another option for accessing things in that map which I discovered few hours back. This option is using ProcessingMessage.asJson() method. I am pasting below a code snippet to show how it can be used final Iterator<ProcessingMessage> processingMessageIterator = jsonSchemaValidationException.getProcessingReport().iterator();
List<String> messageList = new ArrayList<>();
while (processingMessageIterator.hasNext()) {
ProcessingMessage processingMessage = processingMessageIterator.next();
JsonNode jsonNode = processingMessage.asJson();
String fieldJsonSchemaPath = jsonNode.get("schema").get("pointer").toString();
String validationMessage = jsonNode.get("message").toString();
messageList.add(String.format("field: %s , validationMessage: %s",fieldJsonSchemaPath, validationMessage));
} whichever field you wish to get from that map, you can get that like this //asJson() is a public method and gives every information that the map would
JsonNode jsonNode = processingMessage.asJson().get(mapKey); the keys in that map are accessible as this JsonNode fields. Hope this helps you! |
Priya, I will rephrase my request - instead of getting access to the internal map, I would like a method that returns the names of the json properties that failed the validation process |
I would like to get access to the internal map of ProcessingMessage.
The reason: I would like to know the name of the property that failed validation
The rationale: I use json schema to enforce password policy. I would like to detect that provided username and/or password failed validation and give the recomended general error message
right now I scrape the toString() output... seems redundant
alternatively perhaps ProcessingMessage can be enhanced to include getPropertyName() ?
The text was updated successfully, but these errors were encountered: