File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed
src/main/java/com/github/JanLoebel/jsonschemavalidation/provider Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change 55
66 <groupId >com.github.JanLoebel</groupId >
77 <artifactId >json-schema-validation-starter</artifactId >
8- <version >2.0 .0-SNAPSHOT</version >
8+ <version >2.1 .0-SNAPSHOT</version >
99
1010 <properties >
1111 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
Original file line number Diff line number Diff line change 88public class CacheableJsonSchemaProvider extends DefaultJsonSchemaProvider {
99
1010 private final Map <String , JsonSchema > cache = new ConcurrentHashMap <>();
11- private final String basePath ;
12-
13- public CacheableJsonSchemaProvider (String basePath ) {
14- this .basePath = basePath ;
15- }
16-
17- public CacheableJsonSchemaProvider () {
18- this ("" );
19- }
2011
2112 @ Override
2213 public JsonSchema loadSchema (String url ) {
23- final String fullPath = basePath + url ;
24- if (cache .containsKey (fullPath )) {
25- return cache .get (fullPath );
14+ if (cache .containsKey (url )) {
15+ return cache .get (url );
2616 }
2717
28- return putToCache (fullPath , super .loadSchema (fullPath ));
18+ return putToCache (url , super .loadSchema (url ));
2919 }
3020
31- private JsonSchema putToCache (String fullPath , JsonSchema jsonSchema ) {
32- cache .put (fullPath , jsonSchema );
21+ private JsonSchema putToCache (String url , JsonSchema jsonSchema ) {
22+ cache .put (url , jsonSchema );
3323 return jsonSchema ;
3424 }
3525
You can’t perform that action at this time.
0 commit comments