File tree Expand file tree Collapse file tree 2 files changed +43
-2
lines changed
main/java/com/networknt/schema
test/resources/tests/optional Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ private static class DraftV4 {
47
47
public static final List <Format > BUILTIN_FORMATS = new ArrayList <Format >();
48
48
static {
49
49
BUILTIN_FORMATS .add (pattern ("date-time" ,
50
- "^\\ d{4}-(?:0[0-9]{1}|1[0-2]{1})-[ 0-9]{2} [tT ]\\ d{2}:\\ d{2}:\\ d{2}(\\ .\\ d+)?([zZ]|[+-]\\ d{2}:\\ d{2})$" ));
51
- BUILTIN_FORMATS .add (pattern ("date" , "^\\ d{4}-(?:0[0-9]{1}|1[0-2]{1})-[ 0-9]{2} $" ));
50
+ "^\\ d{4}-(?:0[0-9]{1}|1[0-2]{1})-(0?[1-9]|[12][ 0-9]|3[01]) [tT ]\\ d{2}:\\ d{2}:\\ d{2}(\\ .\\ d+)?([zZ]|[+-]\\ d{2}:\\ d{2})$" ));
51
+ BUILTIN_FORMATS .add (pattern ("date" , "^\\ d{4}-(?:0[0-9]{1}|1[0-2]{1})-(0?[1-9]|[12][ 0-9]|3[01]) $" ));
52
52
BUILTIN_FORMATS .add (pattern ("time" , "^\\ d{2}:\\ d{2}:\\ d{2}$" ));
53
53
BUILTIN_FORMATS .add (pattern ("email" , "^\\ S+@\\ S+$" ));
54
54
BUILTIN_FORMATS .add (pattern ("ip-address" ,
Original file line number Diff line number Diff line change 13
13
"data" : " 06/19/1963 08:30:06 PST" ,
14
14
"valid" : false
15
15
},
16
+ {
17
+ "description" : " an invalid date-time string" ,
18
+ "data" : " 1963-13-25T08:30:06.283185Z" ,
19
+ "valid" : false
20
+ },
21
+ {
22
+ "description" : " an invalid date-time string" ,
23
+ "data" : " 1963-12-35T08:30:06.283185Z" ,
24
+ "valid" : false
25
+ },
26
+ {
27
+ "description" : " an invalid date-time string" ,
28
+ "data" : " 1963-12-31T08:30:06.283185Z" ,
29
+ "valid" : true
30
+ },
16
31
{
17
32
"description" : " only RFC3339 not all of ISO 8601 are valid" ,
18
33
"data" : " 2013-350T01:01:01" ,
19
34
"valid" : false
20
35
}
21
36
]
22
37
},
38
+ {
39
+ "description" : " validation of date strings" ,
40
+ "schema" : {"format" : " date" },
41
+ "tests" : [
42
+ {
43
+ "description" : " an invalid date string" ,
44
+ "data" : " 1963-13-25" ,
45
+ "valid" : false
46
+ },
47
+ {
48
+ "description" : " an invalid date string" ,
49
+ "data" : " 1963-12-35" ,
50
+ "valid" : false
51
+ },
52
+ {
53
+ "description" : " an invalid datee string" ,
54
+ "data" : " 1963-12-31" ,
55
+ "valid" : true
56
+ },
57
+ {
58
+ "description" : " only RFC3339 not all of ISO 8601 are valid" ,
59
+ "data" : " 2013-35" ,
60
+ "valid" : false
61
+ }
62
+ ]
63
+ },
23
64
{
24
65
"description" : " validation of URIs" ,
25
66
"schema" : {"format" : " uri" },
You can’t perform that action at this time.
0 commit comments