OpenAPITools / OpenAPITools/openapi-generator
[BUG] python-flask server ImportError exception at launch
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Exception has occurred: ImportError
cannot import name 'FlaskJSONEncoder' from 'connexion.apps' (/home/d3vopz/openapi/.venv/lib/python3.11/site-packages/connexion/apps/__init__.py)
File "/home/d3vopz/openapi/test/resources/spec/out/python-flask-server/openapi/encoder.py", line 1, in <module>
from connexion.apps import FlaskJSONEncoder
File "/home/d3vopz/openapi/test/resources/spec/out/python-flask-server/openapi/__main__.py", line 5, in <module>
from openapi import encoder
ImportError: cannot import name 'FlaskJSONEncoder' from 'connexion.apps' (/home/d3vopz/openapi/.venv/lib/python3.11/site-packages/connexion/apps/__init__.py)
openapi-generator version
7.0.1
OpenAPI declaration file content or url
Generation Details
api: python-flask server
pip3 install -r python-flask-server/requirements.txt
Steps to reproduce
curl api
unzip
pip3 install -r python-flask-server/requirements.txt
run in vscode
"configurations": [
{
"name": "Python: oag",
"type": "python",
"request": "launch",
"program": "/home/d3vopz/openapi/test/resources/spec/out/python-flask-server/openapi/__main__.py",
"console": "integratedTerminal",
"cwd": "/home/d3vopz/openapi",
"env": {
"PYTHONPATH": "/home/d3vopz/openapi/test/python/src:/home/d3vopz/etl/test/src:/home/d3vopz/openapi/test/resources/spec/out/python-flask-server"
},
"envFile": "/home/d3vopz/openapi/.env",
"args":["--resource-path","/home/d3vopz/etl/resources/inject"]
}
]
cd /home/d3vopz/openapi ; /usr/bin/env /home/d3vopz/openapi/.venv/bin/python /home/d3vopz/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 56187 -- /home/d3vopz/openapi/test/resources/spec/out/python-flask-server/openapi/__main__.py --resource-path /home/d3vopz/etl/resources/inject
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the launch failure from test/resources/spec/out/python-flask-server using python-flask-server/requirements.txt, then inspect openapi/encoder.py and openapi/main.py, where the traceback points. Done means the generated server starts without the reported ImportError under the documented installation steps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100