Replace deprecated FormatChecker.cls_checks
The method was deprecated in jsonschema 4.14.0[1] and now triggers the following warning. DeprecationWarning: FormatChecker.cls_checks is deprecated. Call FormatChecker.checks on a specific FormatChecker instance instead. [1] https://github.com/python-jsonschema/jsonschema/commit/cd8f0592b93947a9deb8b3e6502cc5a69cb6d722 Also resolve the following warning at the same time. DeprecationWarning: Accessing jsonschema.draft4_format_checker is deprecated and will be removed in a future release. Instead, use the FORMAT_CHECKER attribute on the corresponding Validator. Closes-Bug: #2089051 Related-Bug: #2008490 Change-Id: I0060e36d0be51cbafca5fef39c11178d2521f23a Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
||||
jsonschema>=3.2.0 # MIT
|
||||
jsonschema>=4.5.0 # MIT
|
||||
testtools>=2.2.0 # MIT
|
||||
paramiko>=2.7.0 # LGPLv2.1+
|
||||
cryptography>=2.1 # BSD/Apache-2.0
|
||||
|
||||
@@ -18,7 +18,7 @@ from oslo_utils import timeutils
|
||||
|
||||
# JSON Schema validator and format checker used for JSON Schema validation
|
||||
JSONSCHEMA_VALIDATOR = jsonschema.Draft4Validator
|
||||
FORMAT_CHECKER = jsonschema.draft4_format_checker
|
||||
FORMAT_CHECKER = JSONSCHEMA_VALIDATOR.FORMAT_CHECKER
|
||||
|
||||
|
||||
# NOTE(gmann): Add customized format checker for 'date-time' format because:
|
||||
@@ -39,7 +39,7 @@ def _validate_datetime_format(instance):
|
||||
return True
|
||||
|
||||
|
||||
@jsonschema.FormatChecker.cls_checks('base64')
|
||||
@FORMAT_CHECKER.checks('base64')
|
||||
def _validate_base64_format(instance):
|
||||
try:
|
||||
if isinstance(instance, str):
|
||||
|
||||
Reference in New Issue
Block a user