I´m trying to validate an incoming json string against a json schema, but instead of throwing an exception if that validation fails, I´d like to forward the validation errors together with the validated json payload:
from("direct:myValidator") .log("Validating json...") .to("json-validator:myschema.json") .onException(org.apache.camel.component.jsonvalidator.JsonValidationException.class) .continued(true) .transform().???;
So ideally I would have a a json object like
“validatedJson”:,
“validationResult”:<excepted integer but got string”
after that. I understand that with simple and ${exception.message} I can access the errors. But I didn´t manager to turn that into valid json and combine it with the original message.