Skip to content

Commit d87c019

Browse files
fduttonFaron Dutton
and
Faron Dutton
authored
Supports relative-json-pointer validation. (#762)
Resolves #761 Co-authored-by: Faron Dutton <[email protected]>
1 parent e73d129 commit d87c019

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ static PatternFormat pattern(String name, String regex) {
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}$"));
9090
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}|\\*)?))*\\})*$"));
91-
COMMON_BUILTIN_FORMATS.add(pattern("json-pointer", "(/([^/#~]|[~](?=[01]))*)*"));
91+
COMMON_BUILTIN_FORMATS.add(pattern("json-pointer", "^(/([^/#~]|[~](?=[01]))*)*$"));
92+
COMMON_BUILTIN_FORMATS.add(pattern("relative-json-pointer", "^(0|([1-9]\\d*))(#|(/([^/#~]|[~](?=[01]))*)*)$"));
9293
COMMON_BUILTIN_FORMATS.add(new DateFormat());
9394
COMMON_BUILTIN_FORMATS.add(new EmailFormat());
9495
COMMON_BUILTIN_FORMATS.add(new RegexFormat());

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ private void disableV202012Tests() {
8282
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/idn-hostname.json"));
8383
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/iri-reference.json"));
8484
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/iri.json"));
85-
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/relative-json-pointer.json"));
8685
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/optional/format/uri-reference.json"));
8786
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/ref.json"));
8887
this.disabled.add(Paths.get("src/test/suite/tests/draft2020-12/refRemote.json"));
@@ -99,7 +98,6 @@ private void disableV201909Tests() {
9998
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/idn-hostname.json"));
10099
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/iri-reference.json"));
101100
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/iri.json"));
102-
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/relative-json-pointer.json"));
103101
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/optional/format/uri-reference.json"));
104102
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/recursiveRef.json"));
105103
this.disabled.add(Paths.get("src/test/suite/tests/draft2019-09/ref.json"));
@@ -117,7 +115,6 @@ private void disableV7Tests() {
117115
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/idn-hostname.json"));
118116
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/iri-reference.json"));
119117
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/iri.json"));
120-
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/relative-json-pointer.json"));
121118
this.disabled.add(Paths.get("src/test/suite/tests/draft7/optional/format/uri-reference.json"));
122119
this.disabled.add(Paths.get("src/test/suite/tests/draft7/ref.json"));
123120
this.disabled.add(Paths.get("src/test/suite/tests/draft7/refRemote.json"));

0 commit comments

Comments
 (0)