Skip to content

Commit

Permalink
Avoid warning with jsonschema 4.16.0 (#1601)
Browse files Browse the repository at this point in the history
Accessing jsonschema.draftN_format_checker is now deprecated
  • Loading branch information
gaetano-guerriero committed Oct 7, 2022
1 parent 59f619c commit c899132
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion connexion/decorators/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import logging
import typing as t

from jsonschema import Draft4Validator, ValidationError, draft4_format_checker
from jsonschema import Draft4Validator, ValidationError
from jsonschema.validators import extend
from werkzeug.datastructures import FileStorage

Expand All @@ -22,6 +22,11 @@

TYPE_MAP = {"integer": int, "number": float, "boolean": boolean, "object": dict}

try:
draft4_format_checker = Draft4Validator.FORMAT_CHECKER
except AttributeError: # jsonschema < 4.5.0
from jsonschema import draft4_format_checker


class TypeValidationError(Exception):
def __init__(self, schema_type, parameter_type, parameter_name):
Expand Down

0 comments on commit c899132

Please sign in to comment.