Skip to content

Commit 6b67e39

Browse files
authored
Merge branch 'master' into feature/exclude-findbugs-annotations
2 parents c1daae2 + 4bf148a commit 6b67e39

File tree

7 files changed

+227
-91
lines changed

7 files changed

+227
-91
lines changed

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ timely manner.
3333
## Testing online
3434

3535
You can [test this library online](http://json-schema-validator.herokuapp.com); this web site is in
36-
a [project of its own](https://github.com/java-json-tools/json-schema-validator-demo), which you can fork and
36+
a [project of its own](https://github.com/fge/json-schema-validator-demo), which you can fork and
3737
run by yourself.
3838

3939
## Versions
4040

41-
* current stable version: **2.2.6**
41+
* current stable version: **2.2.10**
4242
([ChangeLog](https://github.com/java-json-tools/json-schema-validator/wiki/ChangeLog_22x),
4343
[Javadoc](http://java-json-tools.github.io/json-schema-validator/2.2.x/index.html), [code
4444
samples](http://java-json-tools.github.io/json-schema-validator/2.2.x/index.html?com/github/fge/jsonschema/examples/package-summary.html)).
@@ -57,7 +57,7 @@ Gradle:
5757

5858
```groovy
5959
dependencies {
60-
compile(group: "com.github.java-json-tools", name: "json-schema-validator", version: "2.2.8");
60+
compile(group: "com.github.java-json-tools", name: "json-schema-validator", version: "2.2.10");
6161
}
6262
```
6363

@@ -67,7 +67,7 @@ Maven:
6767
<dependency>
6868
<groupId>com.github.java-json-tools</groupId>
6969
<artifactId>json-schema-validator</artifactId>
70-
<version>2.2.8</version>
70+
<version>2.2.10</version>
7171
</dependency>
7272
```
7373

Diff for: build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ apply(plugin: "idea");
2525
apply(plugin: "eclipse");
2626

2727
group = "com.github.java-json-tools";
28-
version = "2.2.8";
28+
version = "2.2.10-SNAPSHOT";
2929
sourceCompatibility = "1.6";
3030
targetCompatibility = "1.6"; // defaults to sourceCompatibility
3131

@@ -40,7 +40,7 @@ repositories {
4040
* List of dependencies
4141
*/
4242
dependencies {
43-
compile(group: "com.github.java-json-tools", name: "json-schema-core", version: "1.2.8") {
43+
compile(group: "com.github.java-json-tools", name: "json-schema-core", version: "1.2.9") {
4444
exclude(group: "com.google.code.findbugs")
4545
};
4646
compile(group: "javax.mail", name: "mailapi", version: "1.4.3");

Diff for: src/main/java/com/github/fge/jsonschema/format/common/RFC3339DateTimeAttribute.java

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.util.List;
44

5+
import com.github.fge.jsonschema.cfg.ValidationConfiguration;
6+
import com.github.fge.jsonschema.library.DraftV4Library;
57
import org.joda.time.format.DateTimeFormatter;
68
import org.joda.time.format.DateTimeFormatterBuilder;
79
import org.joda.time.format.DateTimeParser;
@@ -18,6 +20,13 @@
1820
/**
1921
* A {@link DateTimeFormatter} for date and time format defined in RFC3339.
2022
* @see <a href="https://tools.ietf.org/html/rfc3339#section-5.6">RFC 3339 - Section 5.6</a>
23+
*
24+
* This is backwards incompat with the original DateTimeAttribute. It will become the default in the future
25+
* to use it currently you need to:
26+
* Library library = DraftV4Library.get().thaw()
27+
* .addFormatAttribute("date-time", RFC3339DateTimeAttribute.getInstance())
28+
* .freeze();
29+
* Then follow the rest of the steps in example 8 to hook it into your flow.
2130
*/
2231
public class RFC3339DateTimeAttribute extends AbstractFormatAttribute {
2332

Diff for: src/main/java/com/github/fge/jsonschema/library/format/CommonFormatAttributesDictionary.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import com.github.fge.jsonschema.core.util.Dictionary;
2323
import com.github.fge.jsonschema.core.util.DictionaryBuilder;
2424
import com.github.fge.jsonschema.format.FormatAttribute;
25+
import com.github.fge.jsonschema.format.common.DateTimeAttribute;
2526
import com.github.fge.jsonschema.format.common.EmailAttribute;
2627
import com.github.fge.jsonschema.format.common.IPv6Attribute;
27-
import com.github.fge.jsonschema.format.common.RFC3339DateTimeAttribute;
2828
import com.github.fge.jsonschema.format.common.RegexAttribute;
2929
import com.github.fge.jsonschema.format.common.URIAttribute;
3030

@@ -49,7 +49,7 @@ private CommonFormatAttributesDictionary()
4949
FormatAttribute attribute;
5050

5151
name = "date-time";
52-
attribute = RFC3339DateTimeAttribute.getInstance();
52+
attribute = DateTimeAttribute.getInstance();
5353
builder.addEntry(name, attribute);
5454

5555
name = "email";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2014, Francis Galiegue ([email protected])
3+
*
4+
* This software is dual-licensed under:
5+
*
6+
* - the Lesser General Public License (LGPL) version 3.0 or, at your option, any
7+
* later version;
8+
* - the Apache Software License (ASL) version 2.0.
9+
*
10+
* The text of this file and of both licenses is available at the root of this
11+
* project or, if you have the jar distribution, in directory META-INF/, under
12+
* the names LGPL-3.0.txt and ASL-2.0.txt respectively.
13+
*
14+
* Direct link to the sources:
15+
*
16+
* - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt
17+
* - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
18+
*/
19+
20+
package com.github.fge.jsonschema.format.rfc3339;
21+
22+
import com.github.fge.jsonschema.core.util.Dictionary;
23+
import com.github.fge.jsonschema.core.util.DictionaryBuilder;
24+
import com.github.fge.jsonschema.format.AbstractFormatAttributeTest;
25+
import com.github.fge.jsonschema.format.FormatAttribute;
26+
import com.github.fge.jsonschema.format.common.RFC3339DateTimeAttribute;
27+
28+
import java.io.IOException;
29+
import java.text.Format;
30+
31+
public final class DateTimeTest
32+
extends AbstractFormatAttributeTest
33+
{
34+
private static final Dictionary<FormatAttribute> dict =
35+
Dictionary
36+
.<FormatAttribute>newBuilder()
37+
.addEntry("date-time", RFC3339DateTimeAttribute.getInstance())
38+
.freeze();
39+
40+
public DateTimeTest()
41+
throws IOException
42+
{
43+
super(dict, "rfc3339", "date-time");
44+
}
45+
}

Diff for: src/test/resources/format/common/date-time.json

+11-83
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"data": "2012-12-02T13:05:00+01:00",
3+
"data": "2012-12-02T13:05:00+0100",
44
"valid": true
55
},
66
{
@@ -20,101 +20,29 @@
2020
"valid": true
2121
},
2222
{
23-
"data": "2012-08-07T20:42:32+10:00",
24-
"valid": true
25-
},
26-
{
27-
"data": "2012-08-07T20:42:32-05:30",
28-
"valid": true
29-
},
30-
{
31-
"data": "201202030",
32-
"valid": false,
33-
"message": "err.format.invalidDate",
34-
"msgData": {
35-
"value": "201202030",
36-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
37-
},
38-
"msgParams": [ "value", "expected" ]
39-
},
40-
{
41-
"data": "2012-12-02T13:05:00+0100",
42-
"valid": false,
43-
"message": "err.format.invalidDate",
44-
"msgData": {
45-
"value": "2012-12-02T13:05:00+0100",
46-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
47-
},
48-
"msgParams": [ "value", "expected" ]
49-
},
50-
{
51-
"data": "2012-12-02T13:05:00+01:30:30",
52-
"valid": false,
53-
"message": "err.format.invalidDate",
54-
"msgData": {
55-
"value": "2012-12-02T13:05:00+01:30:30",
56-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
57-
},
58-
"msgParams": [ "value", "expected" ]
59-
},
60-
{
61-
"data": "2012-12-02T13:05:00Z[Europe/Paris]",
62-
"valid": false,
63-
"message": "err.format.invalidDate",
64-
"msgData": {
65-
"value": "2012-12-02T13:05:00Z[Europe/Paris]",
66-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
67-
},
68-
"msgParams": [ "value", "expected" ]
69-
},
70-
{
71-
"data": "2012-12-02T13:05:00+10:00Z",
72-
"valid": false,
73-
"message": "err.format.invalidDate",
74-
"msgData": {
75-
"value": "2012-12-02T13:05:00+10:00Z",
76-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
77-
},
78-
"msgParams": [ "value", "expected" ]
79-
},
80-
{
81-
"data": "2012-12-02T13:05:00America/New_York",
23+
"data": "2012-02-30T00:00:00+0000",
8224
"valid": false,
8325
"message": "err.format.invalidDate",
8426
"msgData": {
85-
"value": "2012-12-02T13:05:00America/New_York",
86-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
27+
"value": "2012-02-30T00:00:00+0000",
28+
"expected": [ "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}Z" ]
8729
},
8830
"msgParams": [ "value", "expected" ]
8931
},
9032
{
91-
"data": "2012-12-02T13:05:00[America/New_York]",
92-
"valid": false,
93-
"message": "err.format.invalidDate",
94-
"msgData": {
95-
"value": "2012-12-02T13:05:00[America/New_York]",
96-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
97-
},
98-
"msgParams": [ "value", "expected" ]
99-
},
100-
{
101-
"data": "2012-12-02T13:05:00.123456",
33+
"data": "201202030",
10234
"valid": false,
10335
"message": "err.format.invalidDate",
10436
"msgData": {
105-
"value": "2012-12-02T13:05:00.123456",
106-
"expected": [ "yyyy-MM-dd'T'HH:mm:ss((+|-)HH:mm|Z)", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}((+|-)HH:mm|Z)" ]
37+
"value": "201202030",
38+
"expected": [ "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}Z" ]
10739
},
10840
"msgParams": [ "value", "expected" ]
10941
},
11042
{
11143
"data": "2012-08-07T20:42:32.1234Z",
11244
"valid": true
11345
},
114-
{
115-
"data": "2012-08-07T20:42:32.1234+05:00",
116-
"valid": true
117-
},
11846
{
11947
"data": "2012-08-07T20:42:32.12345Z",
12048
"valid": true
@@ -131,6 +59,10 @@
13159
"data": "2012-08-07T20:42:32.12345678Z",
13260
"valid": true
13361
},
62+
{
63+
"data": "2012-08-07T20:42:32.12345678Z",
64+
"valid": true
65+
},
13466
{
13567
"data": "2012-08-07T20:42:32.123456789Z",
13668
"valid": true
@@ -146,9 +78,5 @@
14678
{
14779
"data": "2012-08-07T20:42:32.123456789012Z",
14880
"valid": true
149-
},
150-
{
151-
"data": "2012-08-07T20:42:32.123456789012+05:00",
152-
"valid": true
15381
}
15482
]

0 commit comments

Comments
 (0)