Skip to content
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

Import in BaseParser causes jsonschema deprecation warning #156

Open
dzen90 opened this issue Aug 29, 2023 · 0 comments
Open

Import in BaseParser causes jsonschema deprecation warning #156

dzen90 opened this issue Aug 29, 2023 · 0 comments

Comments

@dzen90
Copy link

dzen90 commented Aug 29, 2023

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
@dzen90 dzen90 changed the title Import in __init__ causes jsonschema deprecation warning Import in BaseParser causes jsonschema deprecation warning Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant