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

Incompatibility with flask 2.3 #562

Closed
totycro opened this issue Apr 26, 2023 · 0 comments
Closed

Incompatibility with flask 2.3 #562

totycro opened this issue Apr 26, 2023 · 0 comments

Comments

@totycro
Copy link

totycro commented Apr 26, 2023

The relase notes for flask 2.3 contain this:

json_encoder and json_decoder attributes on app and blueprint, and the corresponding json.JSONEncoder and JSONDecoder classes, are removed.

There is some more information in the docs for 2.2 about JSONEncoder.

Currently JSONEncoder is used here in flasgger, leading to this import error:

my_api/__init__.py:9: in <module>
    from flasgger import Swagger
/usr/local/lib/python3.10/site-packages/flasgger/__init__.py:10: in <module>
    from .base import Swagger, Flasgger, NO_SANITIZER, BR_SANITIZER, MK_SANITIZER, LazyJSONEncoder  # noqa
/usr/local/lib/python3.10/site-packages/flasgger/base.py:28: in <module>
    from flask.json import JSONEncoder
E   ImportError: cannot import name 'JSONEncoder' from 'flask.json' (/usr/local/lib/python3.10/site-packages/flask/json/__init__.py)

I think the fix would be to port the serialization behavior to JSONProvider.

There is some information in the PR that introduced JSONProvider about why they changed this.

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