Skip to content

Commit 69555e6

Browse files
fduttonFaron Dutton
and
Faron Dutton
authored
Adds support for validating uri-template formats (#758)
Resolves #756 Co-authored-by: Faron Dutton <[email protected]>
1 parent aaddd0d commit 69555e6

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/main/java/com/networknt/schema/JsonMetaSchema.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ static PatternFormat pattern(String name, String regex) {
8787
COMMON_BUILTIN_FORMATS.add(pattern("utc-millisec", "^[0-9]+(\\.?[0-9]+)?$"));
8888
COMMON_BUILTIN_FORMATS.add(pattern("style", "\\s*(.+?):\\s*([^;]+);?"));
8989
COMMON_BUILTIN_FORMATS.add(pattern("uuid", "^\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}$"));
90+
COMMON_BUILTIN_FORMATS.add(pattern("uri-template", "^([^\\p{Cntrl}\"'%<>\\^`\\{|\\}]|%\\p{XDigit}{2}|\\{[+#./;?&=,!@|]?((\\w|%\\p{XDigit}{2})(\\.?(\\w|%\\p{XDigit}{2}))*(:[1-9]\\d{0,3}|\\*)?)(,((\\w|%\\p{XDigit}{2})(\\.?(\\w|%\\p{XDigit}{2}))*(:[1-9]\\d{0,3}|\\*)?))*\\})*$"));
9091
COMMON_BUILTIN_FORMATS.add(new DateFormat());
9192
COMMON_BUILTIN_FORMATS.add(new EmailFormat());
9293
COMMON_BUILTIN_FORMATS.add(new RegexFormat());

src/test/java/com/networknt/schema/JsonSchemaTestSuiteTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ private void disableV202012Tests() {
8585
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/json-pointer.json"));
8686
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/relative-json-pointer.json"));
8787
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/uri-reference.json"));
88-
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/uri-template.json"));
8988
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/ref.json"));
9089
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/refRemote.json"));
9190
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/vocabulary.json"));
@@ -104,7 +103,6 @@ private void disableV201909Tests() {
104103
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/json-pointer.json"));
105104
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/relative-json-pointer.json"));
106105
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/uri-reference.json"));
107-
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/uri-template.json"));
108106
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/recursiveRef.json"));
109107
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/ref.json"));
110108
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/refRemote.json"));
@@ -124,7 +122,6 @@ private void disableV7Tests() {
124122
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/json-pointer.json"));
125123
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/relative-json-pointer.json"));
126124
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/uri-reference.json"));
127-
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/uri-template.json"));
128125
this.disabled.add(Paths.get("src/test/suite/tests/draft7/ref.json"));
129126
this.disabled.add(Paths.get("src/test/suite/tests/draft7/refRemote.json"));
130127
}
@@ -134,7 +131,6 @@ private void disableV6Tests() {
134131
this.disabled.add(Paths.get("src/test/suite/tests/draft6/optional/format.json"));
135132
this.disabled.add(Paths.get("src/test/suite/tests/draft6/optional/format/json-pointer.json"));
136133
this.disabled.add(Paths.get("src/test/suite/tests/draft6/optional/format/uri-reference.json"));
137-
this.disabled.add(Paths.get("src/test/suite/tests/draft6/optional/format/uri-template.json"));
138134
this.disabled.add(Paths.get("src/test/suite/tests/draft6/ref.json"));
139135
this.disabled.add(Paths.get("src/test/suite/tests/draft6/refRemote.json"));
140136
}

0 commit comments

Comments
 (0)