File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
src/main/java/org/everit/json/schema/internal Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 172
172
<version >1.0.5</version >
173
173
<scope >test</scope >
174
174
</dependency >
175
+ <dependency >
176
+ <groupId >com.damnhandy</groupId >
177
+ <artifactId >handy-uri-templates</artifactId >
178
+ <version >2.1.6</version >
179
+ </dependency >
175
180
</dependencies >
176
181
</project >
Original file line number Diff line number Diff line change 1
1
package org .everit .json .schema .internal ;
2
2
3
+ import static java .lang .String .format ;
4
+
3
5
import java .util .Optional ;
4
6
5
7
import org .everit .json .schema .FormatValidator ;
6
8
9
+ import com .damnhandy .uri .template .MalformedUriTemplateException ;
10
+ import com .damnhandy .uri .template .UriTemplate ;
11
+
7
12
public class URITemplateFormatValidator implements FormatValidator {
8
13
9
14
@ Override public Optional <String > validate (String subject ) {
10
- throw new UnsupportedOperationException ("not yet implemented" );
15
+ try {
16
+ UriTemplate .fromTemplate (subject );
17
+ return Optional .empty ();
18
+ } catch (MalformedUriTemplateException e ) {
19
+ return Optional .of (format ("[%s] is not a valid URI template" , subject ));
20
+ }
11
21
}
12
22
13
23
@ Override public String formatName () {
You can’t perform that action at this time.
0 commit comments