spec-first / connexion

Connexion is a modern Python web framework that makes spec-first and api-first development easy.
https://connexion.readthedocs.io/en/latest/
Apache License 2.0
4.45k stars 755 forks source link

Various jsonschema DeprecationWarnings #1786

Open andrewelamb opened 8 months ago

andrewelamb commented 8 months ago

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 commented 6 months ago

im working on it

rtb-zla-karma commented 6 days ago

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