@@ -82,4 +82,39 @@ void iriShouldFail() {
82
82
assertFalse (messages .isEmpty ());
83
83
}
84
84
85
+ @ Test
86
+ void noAuthorityShouldPass () {
87
+ String schemaData = "{\r \n "
88
+ + " \" format\" : \" uri-reference\" \r \n "
89
+ + "}" ;
90
+
91
+ SchemaValidatorsConfig config = SchemaValidatorsConfig .builder ().formatAssertionsEnabled (true ).build ();
92
+ JsonSchema schema = JsonSchemaFactory .getInstance (VersionFlag .V202012 ).getSchema (schemaData , config );
93
+ Set <ValidationMessage > messages = schema .validate ("\" http://\" " , InputFormat .JSON );
94
+ assertTrue (messages .isEmpty ());
95
+ }
96
+
97
+ @ Test
98
+ void noSchemeNoAuthorityShouldPass () {
99
+ String schemaData = "{\r \n "
100
+ + " \" format\" : \" uri-reference\" \r \n "
101
+ + "}" ;
102
+
103
+ SchemaValidatorsConfig config = SchemaValidatorsConfig .builder ().formatAssertionsEnabled (true ).build ();
104
+ JsonSchema schema = JsonSchemaFactory .getInstance (VersionFlag .V202012 ).getSchema (schemaData , config );
105
+ Set <ValidationMessage > messages = schema .validate ("\" //\" " , InputFormat .JSON );
106
+ assertTrue (messages .isEmpty ());
107
+ }
108
+
109
+ @ Test
110
+ void noPathShouldPass () {
111
+ String schemaData = "{\r \n "
112
+ + " \" format\" : \" uri-reference\" \r \n "
113
+ + "}" ;
114
+
115
+ SchemaValidatorsConfig config = SchemaValidatorsConfig .builder ().formatAssertionsEnabled (true ).build ();
116
+ JsonSchema schema = JsonSchemaFactory .getInstance (VersionFlag .V202012 ).getSchema (schemaData , config );
117
+ Set <ValidationMessage > messages = schema .validate ("\" about:\" " , InputFormat .JSON );
118
+ assertTrue (messages .isEmpty ());
119
+ }
85
120
}
0 commit comments