Skip to content

Switch to a MIT-licensed dependency #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.1
current_version = 0.1.2
tag = True
tag_name = {new_version}
commit = True
Expand Down
2 changes: 1 addition & 1 deletion openapi_schema_validator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__author__ = 'Artur Maciag'
__email__ = '[email protected]'
__version__ = '0.1.1'
__version__ = '0.1.2'
__url__ = 'https://github.com/p1c2u/openapi-schema-validator'
__license__ = 'BSD 3-Clause License'

Expand Down
10 changes: 5 additions & 5 deletions openapi_schema_validator/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from jsonschema.exceptions import FormatError
from six import binary_type, text_type, integer_types

DATETIME_HAS_STRICT_RFC3339 = False
DATETIME_HAS_RFC3339_VALIDATOR = False
DATETIME_HAS_ISODATE = False
DATETIME_RAISES = ()

Expand All @@ -20,11 +20,11 @@
DATETIME_RAISES += (ValueError, isodate.ISO8601Error)

try:
import strict_rfc3339
from rfc3339_validator import validate_rfc3339
except ImportError:
pass
else:
DATETIME_HAS_STRICT_RFC3339 = True
DATETIME_HAS_RFC3339_VALIDATOR = True
DATETIME_RAISES += (ValueError, TypeError)


Expand Down Expand Up @@ -64,8 +64,8 @@ def is_datetime(instance):
if not isinstance(instance, (binary_type, text_type)):
return False

if DATETIME_HAS_STRICT_RFC3339:
return strict_rfc3339.validate_rfc3339(instance)
if DATETIME_HAS_RFC3339_VALIDATOR:
return validate_rfc3339(instance)

if DATETIME_HAS_ISODATE:
return isodate.parse_datetime(instance)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
isodate
jsonschema
six
strict_rfc3339
rfc3339-validator
4 changes: 2 additions & 2 deletions tests/integration/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_nullable(self, schema_type):
])
@mock.patch(
'openapi_schema_validator._format.'
'DATETIME_HAS_STRICT_RFC3339', True
'DATETIME_HAS_RFC3339_VALIDATOR', True
)
@mock.patch(
'openapi_schema_validator._format.'
Expand All @@ -58,7 +58,7 @@ def test_string_format_datetime_strict_rfc3339(self, value):
])
@mock.patch(
'openapi_schema_validator._format.'
'DATETIME_HAS_STRICT_RFC3339', False
'DATETIME_HAS_RFC3339_VALIDATOR', False
)
@mock.patch(
'openapi_schema_validator._format.'
Expand Down