Skip to content

Commit 524b9e8

Browse files
committed
Improved regexp for date format to comfort test suite
1 parent 952c501 commit 524b9e8

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed

CHANGELOG.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Fixed that min/max items/lenght/properties can be float
66
* Fixed that everything with empty `not` is invalid
77
* Improved regexp for email format to comfort test suite
8+
* Improved regexp for date format to comfort test suite
89

910
=== 2.20.0 (2024-06-15)
1011

fastjsonschema/draft07.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class CodeGeneratorDraft07(CodeGeneratorDraft06):
55
FORMAT_REGEXS = dict(CodeGeneratorDraft06.FORMAT_REGEXS, **{
6-
'date': r'^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})\Z',
6+
'date': r'^(?P<year>\d{4})-(?P<month>(0[1-9]|1[1-2]))-(?P<day>(0[1-9]|[12]\d|3[01]))\Z',
77
'iri': r'^\w+:(\/?\/?)[^\s]+\Z',
88
'iri-reference': r'^(\w+:(\/?\/?))?[^#\\\s]*(#[^\\\s]*)?\Z',
99
'idn-email': r'^[^@]+@[^@]+\.[^@]+\Z',

tests/json_schema/test_draft04.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ def pytest_generate_tests(metafunc):
1414
'float-overflow.json',
1515
'unknown.json',
1616
'unknownKeyword.json',
17+
'date-time.json',
1718

1819
# TODO: fix const with booleans to not match numbers
1920
'const.json',
2021
'enum.json',
2122

2223
# TODO: fix formats
23-
'date-time.json',
24-
'date.json',
2524
'ipv4.json',
2625
'ipv6.json',
2726
'time.json',

tests/json_schema/test_draft06.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ def pytest_generate_tests(metafunc):
1414
'float-overflow.json',
1515
'unknown.json',
1616
'unknownKeyword.json',
17+
'date-time.json',
1718

1819
# TODO: fix const with booleans to not match numbers
1920
'const.json',
2021
'enum.json',
2122

2223
# TODO: fix formats
23-
'date-time.json',
24-
'date.json',
2524
'ipv4.json',
2625
'ipv6.json',
2726
'time.json',

tests/json_schema/test_draft07.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ def pytest_generate_tests(metafunc):
1616
'iri.json',
1717
'unknown.json',
1818
'unknownKeyword.json',
19+
'date-time.json',
20+
'date.json',
1921

2022
# TODO: fix const with booleans to not match numbers
2123
'const.json',
2224
'enum.json',
2325

2426
# TODO: fix formats
25-
'date-time.json',
26-
'date.json',
2727
'ipv4.json',
2828
'ipv6.json',
2929
'time.json',

tests/json_schema/test_draft2019.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ def pytest_generate_tests(metafunc):
1616
'iri.json',
1717
'unknown.json',
1818
'unknownKeyword.json',
19+
'date-time.json',
20+
'date.json',
1921

2022
# TODO: fix const with booleans to not match numbers
2123
'const.json',
2224
'enum.json',
2325

2426
# TODO: fix formats
25-
'date-time.json',
26-
'date.json',
2727
'ipv4.json',
2828
'ipv6.json',
2929
'time.json',

0 commit comments

Comments
 (0)