Skip to content

Commit 13e148f

Browse files
committed
fixing #271
1 parent bad9b5a commit 13e148f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

core/src/main/java/org/everit/json/schema/loader/ReferenceLookup.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ Map<String, Object> withoutRef(JsonObject original) {
9191
}
9292

9393
private JsonObject lookupObjById(JsonValue val, String idAttrVal) {
94+
String idKeyword = val.ls.specVersion().idKeyword();
9495
if (val instanceof JsonObject) {
9596
JsonObject obj = (JsonObject) val;
96-
if (obj.containsKey("$id") && obj.require("$id").requireString()
97-
.equals(idAttrVal)) {
97+
if (obj.containsKey(idKeyword)
98+
&& obj.require(idKeyword).typeOfValue() == String.class
99+
&& obj.require(idKeyword).requireString().equals(idAttrVal)) {
98100
return obj;
99101
}
100102
for (String key : obj.keySet()) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)