Skip to content

Commit 3471475

Browse files
committed
Improved error message
1 parent 25fbfeb commit 3471475

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/networknt/schema/DateTimeValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public Set<ValidationMessage> validate(JsonNode node, JsonNode rootNode, String
5656
return errors;
5757
}
5858
if (!isLegalDateTime(node.textValue())) {
59-
errors.add(buildValidationMessage(at, node.textValue()));
59+
errors.add(buildValidationMessage(at, node.textValue(), formatName));
6060
}
6161
return Collections.unmodifiableSet(errors);
6262
}

src/main/java/com/networknt/schema/ValidatorTypeCode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public JsonValidator newValidator(String schemaPath, JsonNode schemaNode, JsonSc
6363
TYPE("type", "1029", new MessageFormat("{0}: {1} found, {2} expected")),
6464
UNION_TYPE("unionType", "1030", new MessageFormat("{0}: {1} found, but {2} is required")),
6565
UNIQUE_ITEMS("uniqueItems", "1031", new MessageFormat("{0}: the items in the array must be unique")),
66-
DATETIME("date-time", "1034", new MessageFormat("{0}: {1} is an invalid date/time"));
66+
DATETIME("date-time", "1034", new MessageFormat("{0}: {1} is an invalid {2}"));
6767

6868
private static Map<String, ValidatorTypeCode> constants = new HashMap<String, ValidatorTypeCode>();
6969

0 commit comments

Comments
 (0)