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

Various jsonschema DeprecationWarnings #1786

Closed
andrewelamb opened this issue Nov 3, 2023 · 5 comments · Fixed by #1974 · May be fixed by #2023
Closed

Various jsonschema DeprecationWarnings #1786

andrewelamb opened this issue Nov 3, 2023 · 5 comments · Fixed by #1974 · May be fixed by #2023

Comments

@andrewelamb
Copy link

andrewelamb commented Nov 3, 2023

Description

When using connexion I see these warnigns popping up:

.venv/lib/python3.10/site-packages/connexion/decorators/validation.py:16
  /workspaces/sage-monorepo/apps/schematic/api/.venv/lib/python3.10/site-packages/connexion/decorators/validation.py:16: 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.
    from jsonschema import Draft4Validator, ValidationError, draft4_format_checker

.venv/lib/python3.10/site-packages/connexion/json_schema.py:16
.venv/lib/python3.10/site-packages/connexion/json_schema.py:16
  /workspaces/sage-monorepo/apps/schematic/api/.venv/lib/python3.10/site-packages/connexion/json_schema.py:16: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.
    from jsonschema import Draft4Validator, RefResolver

.venv/lib/python3.10/site-packages/connexion/json_schema.py:17
  /workspaces/sage-monorepo/apps/schematic/api/.venv/lib/python3.10/site-packages/connexion/json_schema.py:17: 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.
    from jsonschema.exceptions import RefResolutionError, ValidationError  # noqa

I'm using v4.19.2 of jsonschema and v2.14.1 of connexion to get the above warnings, but it looks like they would persist in v3.0.

@afriedman412
Copy link

im working on it

@rtb-zla-karma
Copy link

I confirm that is still presists in

Python 3.12.2
connexion==3.0.6
jsonschema==4.21.1

I've got this after testing project with pytest:

/venv/path/lib/python3.12/site-packages/connexion/json_schema.py:16
/venv/path/lib/python3.12/site-packages/connexion/json_schema.py:16
  /venv/path/lib/python3.12/site-packages/connexion/json_schema.py:16: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.
    from jsonschema import Draft4Validator, RefResolver

/venv/path/lib/python3.12/site-packages/connexion/json_schema.py:17
  /venv/path/lib/python3.12/site-packages/connexion/json_schema.py:17: 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.
    from jsonschema.exceptions import RefResolutionError, ValidationError  # noqa

/venv/path/lib/python3.12/site-packages/connexion/validators/form_data.py:4
/venv/path/lib/python3.12/site-packages/connexion/validators/form_data.py:4
  /venv/path/lib/python3.12/site-packages/connexion/validators/form_data.py:4: 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.
    from jsonschema import ValidationError, draft4_format_checker

/venv/path/lib/python3.12/site-packages/connexion/validators/json.py:6
/venv/path/lib/python3.12/site-packages/connexion/validators/json.py:6
  /venv/path/lib/python3.12/site-packages/connexion/validators/json.py:6: 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.
    from jsonschema import Draft4Validator, ValidationError, draft4_format_checker

This deprecated decorator is also mentioned in docs https://connexion.readthedocs.io/en/stable/validation.html#custom-type-formats

@pgridharan
Copy link

jsonschema deprecated RefResolver. That needs to be migrated aswell.

Migration Guide

@weblab-misha
Copy link

weblab-misha commented Nov 13, 2024

So we need to wait 3.1.1 (>3.1.0) to get rid of the warning?

UPD: No, this line (unused import) produces a deprecation warning.

https://github.com/spec-first/connexion/blame/e4e64d724f77fd3458044901e391580fea9d317e/connexion/json_schema.py#L17

/python3.12/site-packages/connexion/json_schema.py:16: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.
    from jsonschema import Draft4Validator, RefResolver
    
 /python3.12/site-packages/connexion/json_schema.py:17: 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.
    from jsonschema.exceptions import RefResolutionError, ValidationError  # noqa

Tested on the current main

connexion = {git = "https://github.com/spec-first/connexion", rev = "e4e64d724f77fd3458044901e391580fea9d317e", extras = ["flask", "swagger-ui"]}

(pyproject.toml, poetry)

@RobbeSneyders should this issue be reopened?

@radoering
Copy link

I fixed the remaining two deprecation warnings in #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
6 participants