code: public void validate(String json, Schema schema) {
      try {
        schema.validate(new JSONObject(json));
      } catch (ValidationException validationException) {
        throw new JsonValidationException(
            validationException
                .getAllMessages()
                .stream()
                .map(ConstraintViolation::new)
                .collect(toSet()));
      }
    }
docs: Validates that a JSON string conforms to a {@link Schema}.
  
  @param json the JSON string to check
  @param schema the {@link Schema} that the JSON string should conform to
  @throws JsonValidationException if the JSON doesn't conform to the schema, containing a {@link
  ConstraintViolation} for each message