diff --git a/flask_restx/schemas/__init__.py b/flask_restx/schemas/__init__.py index 9a0b7a60..27b98660 100644 --- a/flask_restx/schemas/__init__.py +++ b/flask_restx/schemas/__init__.py @@ -6,7 +6,8 @@ """ import io import json -import pkg_resources + +import importlib_resources from collections.abc import Mapping from jsonschema import Draft4Validator @@ -56,8 +57,9 @@ def __init__(self, filename, validator=Draft4Validator): def _load(self): if not self._schema: - filename = pkg_resources.resource_filename(__name__, self.filename) - with io.open(filename) as infile: + ref = importlib_resources.files(__name__) / self.filename + + with io.open(ref) as infile: self._schema = json.load(infile) def __getitem__(self, key): diff --git a/requirements/install.pip b/requirements/install.pip index 13e504db..e429bf27 100644 --- a/requirements/install.pip +++ b/requirements/install.pip @@ -3,3 +3,4 @@ jsonschema Flask>=0.8, !=2.0.0 werkzeug !=2.0.0 pytz +importlib_resources