Skip to content

Import in BaseParser causes jsonschema deprecation warning #156

@dzen90

Description

@dzen90

Hi, I am trying to generate models from openapi3 schema using BaseParser class.
It imports jsonschema's RefResolutionError, which is now showing deprecation warning.
I am using prance==23.6.21.0 and jsonschema==4.19.0

    def _validate_openapi_spec_validator(
        self, spec_version: Version
    ):  # pragma: nocover
        from openapi_spec_validator import validate_spec
        from jsonschema.exceptions import ValidationError as JSEValidationError
        from jsonschema.exceptions import RefResolutionError

Actual Behaviour

../../../../../.virtualenvs/my_proj/lib/python3.8/site-packages/prance/__init__.py:118: in __init__
    self.parse()
../../../../../.virtualenvs/my_proj/lib/python3.8/site-packages/prance/__init__.py:148: in parse
    self._validate()
../../../../../.virtualenvs/my_proj/lib/python3.8/site-packages/prance/__init__.py:187: in _validate
    validator(parsed)
../../../../../.virtualenvs/my_proj/lib/python3.8/site-packages/prance/__init__.py:234: in _validate_openapi_spec_validator
    from jsonschema.exceptions import RefResolutionError
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'RefResolutionError'

    def __getattr__(name):
        if name == "RefResolutionError":
>           warnings.warn(
                _RefResolutionError._DEPRECATION_MESSAGE,
                DeprecationWarning,
                stacklevel=2,
            )
E           DeprecationWarning: jsonschema.exceptions.RefResolutionError is deprecated as of version 4.18.0. If you wish to catch potential reference resolution errors, directly catch referencing.exceptions.Unresolvable.

Thanks in advance.

Environment

  • OS: macOS 11.7.8
  • Python version: 3.8.7
  • Swagger/OpenAPI version used: 3.0.2
  • Backend: openapi-spec-validator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions