File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
tests/vanilla/src/main/java/org/everit/json/schema Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 15
15
import static org .everit .json .schema .FormatValidator .NONE ;
16
16
17
17
import java .util .Objects ;
18
+ import java .util .HashMap ;
18
19
19
20
import org .everit .json .schema .internal .JSONPrinter ;
20
21
import org .everit .json .schema .regexp .JavaUtilRegexpFactory ;
@@ -39,13 +40,11 @@ public void validateCustomType() throws IOException {
39
40
IOUtils .toString (
40
41
new InputStreamReader (getClass ().getResourceAsStream ("/org/everit/json/schema/customType/fails.json" )))
41
42
));
42
-
43
- SchemaLoader .SchemaLoaderBuilder loaderBuilder = SchemaLoader .builder ();
44
- loaderBuilder .addCustomType ("customType" ,CustomTestSchema .class );
45
- //loaderBuilder.schemaJson(jsonSchema);
46
- SchemaLoader sLoader = loaderBuilder .build ();
47
43
48
- Schema schema = sLoader .load (jsonSchema );
44
+ // An easy way to register the custom types
45
+ HashMap <String ,AbstractCustomTypeSchema > customTypes = new HashMap <>();
46
+ customTypes .put ("customType" ,CustomTestSchema .class );
47
+ Schema schema = SchemaLoader .load (jsonSchema ,customTypes );
49
48
50
49
schema .validate (worksJson );
51
50
schema .validate (failsJson );
You can’t perform that action at this time.
0 commit comments