class UpdateMessagePatchValidator implements Validator<ObjectNode> {

    @Override
    public Set<ValidationResult> validate(ObjectNode json) {
        try {
            parser.readValue(json.toString(), UpdateMessagePatch.class);
        } catch (JsonMappingException e) {
            return ImmutableSet.of(ValidationResult.builder()
                    .property(firstFieldFrom(e.getPath()).orElse(ValidationResult.UNDEFINED_PROPERTY))
                    .message(e.getMessage())
                    .build());
        } catch (IOException e) {
            return ImmutableSet.of(ValidationResult.builder()
                    .message(e.getMessage())
                    .build());
        }
        return ImmutableSet.of();
    }

    @Inject @VisibleForTesting  UpdateMessagePatchValidator(ObjectMapperFactory parserFactory);

}