File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
core/src/main/java/org/everit/json/schema/loader
tests/src/test/resources/org/everit/json/schema/issues/issue62 Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -222,13 +222,11 @@ public SchemaLoader(final SchemaLoaderBuilder builder) {
222
222
223
223
private CombinedSchema .Builder buildAnyOfSchemaForMultipleTypes () {
224
224
JSONArray subtypeJsons = ls .schemaJson .getJSONArray ("type" );
225
- Map <String , Object > dummyJson = new HashMap <String , Object >();
226
- Collection <Schema > subschemas = new ArrayList <Schema >(subtypeJsons .length ());
225
+ Collection <Schema > subschemas = new ArrayList <>(subtypeJsons .length ());
227
226
for (int i = 0 ; i < subtypeJsons .length (); ++i ) {
228
227
Object subtypeJson = subtypeJsons .get (i );
229
- dummyJson .put ("type" , subtypeJson );
230
- JSONObject child = new JSONObject (dummyJson );
231
- subschemas .add (loadChild (child ).build ());
228
+ Schema .Builder <?> schemaBuilder = loadForExplicitType ((String ) subtypeJson );
229
+ subschemas .add (schemaBuilder .build ());
232
230
}
233
231
return CombinedSchema .anyOf (subschemas );
234
232
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "$schema" : " http://json-schema.org/draft-04/schema#" ,
3
+ "type" : " object" ,
4
+ "properties" : {
5
+ "only_as_1" : {
6
+ "pattern" : " ^a+$" ,
7
+ "type" : [" string" , " null" ]
8
+ }
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "only_as_1" : " bbb"
3
+ }
You can’t perform that action at this time.
0 commit comments