@Test public void createWithRelativePath() throws URISyntaxException { URI addressSchemaUri = getClass().getResource("/schema/address.json").toURI(); SchemaStore schemaStore = new SchemaStore(); Schema addressSchema = schemaStore.create(addressSchemaUri, "#/."); Schema enumSchema = schemaStore.create(addressSchema, "enum.json", "#/."); String expectedUri = removeEnd(addressSchemaUri.toString(), "address.json") + "enum.json"; assertThat(enumSchema, is(notNullValue())); assertThat(enumSchema.getId(), is(equalTo(URI.create(expectedUri)))); assertThat(enumSchema.getContent().has("enum"), is(true)); }
public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent, null); if (normalizedId.toString().contains("#")) { JsonNode childContent = fragmentResolver.resolve(baseContent, '#' + id.getFragment(), refFragmentPathDelimiters); schemas.put(normalizedId, new Schema(normalizedId, childContent, baseSchema)); } else { schemas.put(normalizedId, baseSchema); } } return schemas.get(normalizedId); }
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent, null); if (normalizedId.toString().contains("#")) { JsonNode childContent = fragmentResolver.resolve(baseContent, '#' + id.getFragment(), refFragmentPathDelimiters); schemas.put(normalizedId, new Schema(normalizedId, childContent, baseSchema)); } else { schemas.put(normalizedId, baseSchema); } } return schemas.get(normalizedId); } }
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent, null); if (normalizedId.toString().contains("#")) { JsonNode childContent = fragmentResolver.resolve(baseContent, '#' + id.getFragment(), refFragmentPathDelimiters); schemas.put(normalizedId, new Schema(normalizedId, childContent, baseSchema)); } else { schemas.put(normalizedId, baseSchema); } } return schemas.get(normalizedId); } SchemaStore();  SchemaStore(ContentResolver contentResolver); }
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent, null); if (normalizedId.toString().contains("#")) { JsonNode childContent = fragmentResolver.resolve(baseContent, '#' + id.getFragment(), refFragmentPathDelimiters); schemas.put(normalizedId, new Schema(normalizedId, childContent, baseSchema)); } else { schemas.put(normalizedId, baseSchema); } } return schemas.get(normalizedId); } SchemaStore();  SchemaStore(ContentResolver contentResolver); synchronized Schema create(URI id, String refFragmentPathDelimiters); @SuppressWarnings("PMD.UselessParentheses") Schema create(Schema parent, String path, String refFragmentPathDelimiters); synchronized void clearCache(); }
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent, null); if (normalizedId.toString().contains("#")) { JsonNode childContent = fragmentResolver.resolve(baseContent, '#' + id.getFragment(), refFragmentPathDelimiters); schemas.put(normalizedId, new Schema(normalizedId, childContent, baseSchema)); } else { schemas.put(normalizedId, baseSchema); } } return schemas.get(normalizedId); } SchemaStore();  SchemaStore(ContentResolver contentResolver); synchronized Schema create(URI id, String refFragmentPathDelimiters); @SuppressWarnings("PMD.UselessParentheses") Schema create(Schema parent, String path, String refFragmentPathDelimiters); synchronized void clearCache();  }