コード例 #1
0
  @Override
  void checkValue(final Message.Builder msg, final List<Message> messages, final JsonNode schema) {
    final String value = schema.get(keyword).textValue();
    if (RhinoHelper.regexIsValid(value)) return;

    msg.setMessage("pattern is not a valid ECMA 262 regex").addInfo("found", value);

    messages.add(msg.build());
  }
コード例 #2
0
  @Override
  protected void validate(
      final ValidationContext context, final ValidationReport report, final JsonNode instance) {
    if (!uniqueItems) return;

    final Set<JsonNode> set = Sets.newHashSet();

    for (final JsonNode element : instance)
      if (!set.add(element)) {
        final Message.Builder msg = newMsg().setMessage("duplicate elements in array");
        report.addMessage(msg.build());
        return;
      }
  }