Skip to content

Commit c9ed1bf

Browse files
authored
Allow fetching /properties from map with comparator (#541)
* Return 0 if both arguments equal to be able to lookup /properties from map * Fix typo
1 parent 45d3bc1 commit c9ed1bf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,13 @@ private Map<String, JsonValidator> read(JsonNode schemaNode) {
219219
}
220220

221221
/**
222-
* A comparator that sorts validators, such such that 'properties' comes before 'required',
222+
* A comparator that sorts validators, such that 'properties' comes before 'required',
223223
* so that we can apply default values before validating required.
224224
*/
225225
private static Comparator<String> VALIDATOR_SORT = (lhs, rhs) -> {
226+
if (lhs.equals(rhs)) {
227+
return 0;
228+
}
226229
if (lhs.endsWith("/properties")) {
227230
return -1;
228231
}

0 commit comments

Comments
 (0)