Refine search
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final int size = data.getInstance().getNode().size(); if (size > intValue) report.error(newMsg(data, bundle, "err.draftv4.maxProperties.tooManyMembers") .putArgument("found", size).putArgument("required", intValue)); } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String value = data.getInstance().getNode().textValue(); final int size = value.codePointCount(0, value.length()); if (size < intValue) report.error(newMsg(data, bundle, "err.common.minLength.tooShort") .putArgument("value", value).putArgument("found", size) .putArgument(keyword, intValue)); } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final int size = data.getInstance().getNode().size(); if (size > intValue) report.error(newMsg(data, bundle, "err.common.maxItems.arrayTooLarge") .putArgument(keyword, intValue).putArgument("found", size)); } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { if (additionalOK) return; final int size = data.getInstance().getNode().size(); if (size > itemsSize) report.error(newMsg(data, bundle, "err.common.additionalItems.notAllowed") .putArgument("allowed", itemsSize).putArgument("found", size)); }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final int size = data.getInstance().getNode().size(); if (size < intValue) report.error(newMsg(data, bundle, "err.common.minItems.arrayTooShort") .putArgument(keyword, intValue).putArgument("found", size)); } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String value = data.getInstance().getNode().textValue(); final int size = value.codePointCount(0, value.length()); if (size > intValue) report.error(newMsg(data, bundle, "err.common.maxLength.tooLong") .putArgument("value", value).putArgument("found", size) .putArgument(keyword, intValue)); } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final int size = data.getInstance().getNode().size(); if (size < intValue) report.error(newMsg(data, bundle, "err.draftv4.minProperties.notEnoughMembers") .putArgument("found", size).putArgument("required", intValue)); } }
@Override public void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String value = data.getInstance().getNode().textValue(); try { FORMATTER.parseDateTime(value); } catch (IllegalArgumentException ignored) { report.error(newMsg(data, bundle, "err.format.invalidDate") .putArgument("value", value).putArgument("expected", FORMATS)); } } }
@Override public void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String input = data.getInstance().getNode().textValue(); if (!MACADDR.matcher(input).matches()) report.error(newMsg(data, bundle, "err.format.macAddr.invalid") .putArgument("value", input)); } }
@Override public final void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final DateTimeFormatter formatter = getFormatter(); final String value = data.getInstance().getNode().textValue(); try { formatter.parseDateTime(value); } catch (IllegalArgumentException ignored) { report.error(newMsg(data, bundle, "err.format.invalidDate") .putArgument("value", value).putArgument("expected", format)); } } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final JsonNode node = data.getInstance().getNode(); for (final JsonNode enumValue: values) if (EQUIVALENCE.equivalent(enumValue, node)) return; report.error(newMsg(data, bundle, "err.common.enum.notInEnum") .putArgument("value", node).putArgument(keyword, values)); }
@Override public void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String input = data.getInstance().getNode().textValue(); try { UUID.fromString(input); } catch (IllegalArgumentException ignored) { report.error(newMsg(data, bundle, "err.format.UUID.invalid") .putArgument("value", input)); } } }
@Override public final void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String input = data.getInstance().getNode().textValue(); if (length != input.length()) { report.error(newMsg(data, bundle, "err.format.hexString.badLength") .putArgument("actual", input.length()) .putArgument("expected", length)); return; } if (HEX_CHARS.matchesAllOf(input)) return; final int index = HEX_CHARS.negate().indexIn(input); report.error(newMsg(data, bundle, "err.format.hexString.illegalChar") .putArgument("character", Character.toString(input.charAt(index))) .putArgument("index", index)); } }
@Override public void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String value = data.getInstance().getNode().textValue(); try { new InternetAddress(value, true); } catch (AddressException ignored) { report.error(newMsg(data, bundle, "err.format.invalidEmail") .putArgument("value", value)); } } }
@Override public void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String value = data.getInstance().getNode().textValue(); try { new URI(value); } catch (URISyntaxException ignored) { report.error(newMsg(data, bundle, "err.format.invalidURI") .putArgument("value", value)); } } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final Set<String> set = Sets.newLinkedHashSet(required); set.removeAll(Sets.newHashSet(data.getInstance().getNode() .fieldNames())); if (!set.isEmpty()) report.error(newMsg(data, bundle, "err.common.object.missingMembers") .put("required", required) .putArgument("missing", toArrayNode(set))); }
@Override public void validate(final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String input = data.getInstance().getNode().textValue(); /* * The string length must be a multiple of 4. FIXME though: can it be 0? * Here, it is assumed that it can, even though that does not really * make sense. */ if (input.length() % 4 != 0) { report.error(newMsg(data, bundle, "err.format.base64.badLength") .putArgument("length", input.length())); return; } final int index = NOT_BASE64.indexIn(PATTERN.matcher(input).replaceFirst("")); if (index == -1) return; report.error(newMsg(data, bundle, "err.format.base64.illegalChars") .putArgument("character", Character.toString(input.charAt(index))) .putArgument("index", index)); } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final NodeType type = NodeType.getNodeType(data.getInstance().getNode()); if (!types.contains(type)) report.error(newMsg(data, bundle, "err.common.typeNoMatch") .putArgument("found", type) .putArgument("expected", toArrayNode(types))); }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final String regex = data.getSchema().getNode().get(keyword) .textValue(); final String value = data.getInstance().getNode().textValue(); if (!RhinoHelper.regMatch(regex, value)) report.error(newMsg(data, bundle, "err.common.pattern.noMatch") .putArgument("regex", regex).putArgument("string", value)); }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final Set<String> set = Sets.newLinkedHashSet(required); set.removeAll(Sets.newHashSet(data.getInstance().getNode() .fieldNames())); if (!set.isEmpty()) report.error(newMsg(data, bundle, "err.common.object.missingMembers") .put("required", required) .putArgument("missing", toArrayNode(set))); }