Skip to content

Commit

Permalink
Avoid re-reading JSON content in SchemaStore
Browse files Browse the repository at this point in the history
Closes #1423
  • Loading branch information
joelittlejohn committed Jan 29, 2023
1 parent 9315b7b commit d434fa1
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ public synchronized Schema create(URI id, String refFragmentPathDelimiters) {
if (!schemas.containsKey(normalizedId)) {

URI baseId = removeFragment(id).normalize();
JsonNode baseContent = contentResolver.resolve(baseId);

Schema baseSchema = new Schema(baseId, baseContent, null);
if (!schemas.containsKey(baseId)) {
final JsonNode baseContent = contentResolver.resolve(baseId);
schemas.put(baseId, new Schema(baseId, baseContent, null));
}

final Schema baseSchema = schemas.get(baseId);
if (normalizedId.toString().contains("#")) {
JsonNode childContent = fragmentResolver.resolve(baseContent, '#' + id.getFragment(), refFragmentPathDelimiters);
JsonNode childContent = fragmentResolver.resolve(baseSchema.getContent(), '#' + id.getFragment(), refFragmentPathDelimiters);
schemas.put(normalizedId, new Schema(normalizedId, childContent, baseSchema));
} else {
schemas.put(normalizedId, baseSchema);
}
}

Expand Down

0 comments on commit d434fa1

Please sign in to comment.