Skip to content

Commit bc681d2

Browse files
committed
upgrade to 1.0.35 and update changelog
1 parent e4809e7 commit bc681d2

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Changed
1111

12+
## 1.0.35 - 2020-03-13
13+
14+
### Added
15+
16+
### Changed
17+
18+
- fixes #272 Use ECMA-262 validator when requested. Thanks @eirnym
19+
1220
## 1.0.34 - 2020-03-12
1321

1422
### Added

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ Maven:
8080
<dependency>
8181
<groupId>com.networknt</groupId>
8282
<artifactId>json-schema-validator</artifactId>
83-
<version>1.0.34</version>
83+
<version>1.0.35</version>
8484
</dependency>
8585
```
8686

8787
Gradle:
8888

8989
```
9090
dependencies {
91-
compile(group: "com.networknt", name: "json-schema-validator", version: "1.0.34");
91+
compile(group: "com.networknt", name: "json-schema-validator", version: "1.0.35");
9292
}
9393
```
9494

@@ -112,6 +112,7 @@ For the latest version, please check the [release](https://github.com/networknt/
112112

113113
## [Collector Context](doc/collector_context.md)
114114

115+
## [ECMA-262 Regex](doc/ecma-262.md)
115116

116117
## Known issues
117118

doc/ecma-262.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
For the pattern validator, we now have two options for regex in the library. The default one is java.util. regex; however, you can use the ECMA-262 standard library org.jruby.joni by configuration.
2+
3+
As we know, the JSON schema is designed based on the Javascript language and its regex. The Java internal implementation has some differences which don't comply with the standard. For most users, these edge cases are not the issue as they are not using them anyway. Even when they are using it, they are expecting the Java regex result as the application is built on the Java platform. For users who want to ensure that they are using 100% standard patter validator, we have provided an option to override the default regex library with org.jruby.joni that is complying with the ECMA-262 standard.
4+
5+
### Which one to choose?
6+
7+
If you want a faster regex lib and don't care about the slight difference between Java and Javascript regex, then you don't need to do anything. The default regex lib is the java.util.regex.
8+
9+
If you want to ensure full compliance, use the org.jruby.joni. It is 1.5 times slower then java.util.regex. Depending on your use case, it might not be an issue.
10+
11+
### How to switch?
12+
13+
Here is the test case that shows how to pass a config object to use the ECMA-262 library.
14+
15+
```
16+
@Test(expected = JsonSchemaException.class)
17+
public void testInvalidPatternPropertiesValidatorECMA262() throws Exception {
18+
SchemaValidatorsConfig config = new SchemaValidatorsConfig();
19+
config.setEcma262Validator(true);
20+
JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V4);
21+
JsonSchema schema = factory.getSchema("{\"patternProperties\":6}", config);
22+
23+
JsonNode node = getJsonNodeFromStringContent("");
24+
Set<ValidationMessage> errors = schema.validate(node);
25+
Assert.assertEquals(errors.size(), 0);
26+
}
27+
```
28+
29+

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<modelVersion>4.0.0</modelVersion>
2121
<groupId>com.networknt</groupId>
2222
<artifactId>json-schema-validator</artifactId>
23-
<version>1.0.34</version>
23+
<version>1.0.35</version>
2424
<packaging>bundle</packaging>
2525
<description>A json schema validator that supports draft v4, v6, v7 and v2019-09</description>
2626
<url>https://github.com/networknt/json-schema-validator</url>

0 commit comments

Comments
 (0)