Skip to content

Commit

Permalink
Improved regexp for date format to comfort test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
horejsek committed Jun 16, 2024
1 parent 952c501 commit 524b9e8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Fixed that min/max items/lenght/properties can be float
* Fixed that everything with empty `not` is invalid
* Improved regexp for email format to comfort test suite
* Improved regexp for date format to comfort test suite

=== 2.20.0 (2024-06-15)

Expand Down
2 changes: 1 addition & 1 deletion fastjsonschema/draft07.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class CodeGeneratorDraft07(CodeGeneratorDraft06):
FORMAT_REGEXS = dict(CodeGeneratorDraft06.FORMAT_REGEXS, **{
'date': r'^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})\Z',
'date': r'^(?P<year>\d{4})-(?P<month>(0[1-9]|1[1-2]))-(?P<day>(0[1-9]|[12]\d|3[01]))\Z',
'iri': r'^\w+:(\/?\/?)[^\s]+\Z',
'iri-reference': r'^(\w+:(\/?\/?))?[^#\\\s]*(#[^\\\s]*)?\Z',
'idn-email': r'^[^@]+@[^@]+\.[^@]+\Z',
Expand Down
3 changes: 1 addition & 2 deletions tests/json_schema/test_draft04.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ def pytest_generate_tests(metafunc):
'float-overflow.json',
'unknown.json',
'unknownKeyword.json',
'date-time.json',

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

# TODO: fix formats
'date-time.json',
'date.json',
'ipv4.json',
'ipv6.json',
'time.json',
Expand Down
3 changes: 1 addition & 2 deletions tests/json_schema/test_draft06.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ def pytest_generate_tests(metafunc):
'float-overflow.json',
'unknown.json',
'unknownKeyword.json',
'date-time.json',

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

# TODO: fix formats
'date-time.json',
'date.json',
'ipv4.json',
'ipv6.json',
'time.json',
Expand Down
4 changes: 2 additions & 2 deletions tests/json_schema/test_draft07.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def pytest_generate_tests(metafunc):
'iri.json',
'unknown.json',
'unknownKeyword.json',
'date-time.json',
'date.json',

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

# TODO: fix formats
'date-time.json',
'date.json',
'ipv4.json',
'ipv6.json',
'time.json',
Expand Down
4 changes: 2 additions & 2 deletions tests/json_schema/test_draft2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def pytest_generate_tests(metafunc):
'iri.json',
'unknown.json',
'unknownKeyword.json',
'date-time.json',
'date.json',

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

# TODO: fix formats
'date-time.json',
'date.json',
'ipv4.json',
'ipv6.json',
'time.json',
Expand Down

0 comments on commit 524b9e8

Please sign in to comment.