@@ -41,7 +41,6 @@ public static class Builder {
41
41
private URLFetcher urlFetcher ;
42
42
private String defaultMetaSchemaURI ;
43
43
private Map <String , JsonMetaSchema > jsonMetaSchemas = new HashMap <String , JsonMetaSchema >();
44
- private Map <URL , URL > urlMap = new HashMap <URL , URL >();
45
44
46
45
public Builder objectMapper (ObjectMapper objectMapper ) {
47
46
this .objectMapper = objectMapper ;
@@ -70,19 +69,13 @@ public Builder addMetaSchemas(Collection<? extends JsonMetaSchema> jsonMetaSchem
70
69
return this ;
71
70
}
72
71
73
- public Builder addUrlMappings (Map <URL , URL > map ) {
74
- this .urlMap .putAll (map );
75
- return this ;
76
- }
77
-
78
72
public JsonSchemaFactory build () {
79
73
// create builtin keywords with (custom) formats.
80
74
return new JsonSchemaFactory (
81
75
objectMapper == null ? new ObjectMapper () : objectMapper ,
82
76
urlFetcher == null ? new StandardURLFetcher (): urlFetcher ,
83
77
defaultMetaSchemaURI ,
84
- jsonMetaSchemas ,
85
- urlMap
78
+ jsonMetaSchemas
86
79
);
87
80
}
88
81
}
@@ -91,9 +84,8 @@ public JsonSchemaFactory build() {
91
84
private final URLFetcher urlFetcher ;
92
85
private final String defaultMetaSchemaURI ;
93
86
private final Map <String , JsonMetaSchema > jsonMetaSchemas ;
94
- private final Map <URL , URL > urlMap ;
95
87
96
- private JsonSchemaFactory (ObjectMapper mapper , URLFetcher urlFetcher , String defaultMetaSchemaURI , Map <String , JsonMetaSchema > jsonMetaSchemas , Map < URL , URL > urlMap ) {
88
+ private JsonSchemaFactory (ObjectMapper mapper , URLFetcher urlFetcher , String defaultMetaSchemaURI , Map <String , JsonMetaSchema > jsonMetaSchemas ) {
97
89
if (mapper == null ) {
98
90
throw new IllegalArgumentException ("ObjectMapper must not be null" );
99
91
}
@@ -109,14 +101,10 @@ private JsonSchemaFactory(ObjectMapper mapper, URLFetcher urlFetcher, String def
109
101
if (jsonMetaSchemas .get (defaultMetaSchemaURI ) == null ) {
110
102
throw new IllegalArgumentException ("Meta Schema for default Meta Schema URI must be provided" );
111
103
}
112
- if (urlMap == null ) {
113
- throw new IllegalArgumentException ("URL Mappings must not be null" );
114
- }
115
104
this .mapper = mapper ;
116
105
this .defaultMetaSchemaURI = defaultMetaSchemaURI ;
117
106
this .urlFetcher = urlFetcher ;
118
107
this .jsonMetaSchemas = jsonMetaSchemas ;
119
- this .urlMap = urlMap ;
120
108
}
121
109
122
110
/**
@@ -147,8 +135,7 @@ public static Builder builder(JsonSchemaFactory blueprint) {
147
135
.addMetaSchemas (blueprint .jsonMetaSchemas .values ())
148
136
.urlFetcher (blueprint .urlFetcher )
149
137
.defaultMetaSchemaURI (blueprint .defaultMetaSchemaURI )
150
- .objectMapper (blueprint .mapper )
151
- .addUrlMappings (blueprint .urlMap );
138
+ .objectMapper (blueprint .mapper );
152
139
}
153
140
154
141
private JsonSchema newJsonSchema (JsonNode schemaNode , SchemaValidatorsConfig config ) {
@@ -204,11 +191,8 @@ public JsonSchema getSchema(InputStream schemaStream) {
204
191
public JsonSchema getSchema (URL schemaURL , SchemaValidatorsConfig config ) {
205
192
try {
206
193
InputStream inputStream = null ;
207
- Map <URL , URL > map = (config != null ) ? config .getUrlMappings () : new HashMap <URL , URL >(urlMap );
208
- map .putAll (urlMap );
209
- URL mappedURL = map .getOrDefault (schemaURL , schemaURL );
210
194
try {
211
- inputStream = urlFetcher .fetch (mappedURL );
195
+ inputStream = urlFetcher .fetch (schemaURL );
212
196
JsonNode schemaNode = mapper .readTree (inputStream );
213
197
final JsonMetaSchema jsonMetaSchema = findMetaSchemaForSchema (schemaNode );
214
198
0 commit comments