swagger-api / swagger-api/swagger-codegen
[PYTHON] Bug Binary module missing
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
While trying to run the python flask for the first time, I got the following error:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/mnt/c/Users/matir/Downloads/python-flask-server-generated/swagger_server/main.py", line 16, in
main()
File "/mnt/c/Users/matir/Downloads/python-flask-server-generated/swagger_server/main.py", line 11, in main
app.add_api('swagger.yaml', arguments={'title': 'AnyVision API Documentation'})
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/apps/flask_app.py", line 54, in add_api
api = super(FlaskApp, self).add_api(specification, **kwargs)
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/apps/abstract.py", line 155, in add_api
options=api_options.as_dict())
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 109, in init
self.add_paths()
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 214, in add_paths
self._handle_add_operation_error(path, method, err.exc_info)
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 228, in _handle_add_operation_error
six.reraise(*exc_info)
File "/home/mrozenblum/.local/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/resolver.py", line 61, in resolve_function_from_operation_id
return self.function_resolver(operation_id)
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/utils.py", line 100, in get_function_from_name
raise last_import_error
File "/home/mrozenblum/.local/lib/python3.6/site-packages/connexion/utils.py", line 88, in get_function_from_name
module = importlib.import_module(module_name)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/mnt/c/Users/matir/Downloads/python-flask-server-generated/swagger_server/controllers/camera_controller.py", line 4, in
from swagger_server.models.binary import Binary # noqa: E501
ModuleNotFoundError: No module named 'swagger_server.models.binary'
Effectively there is no model called Binary under models folder.
Command line used for generation
python3 -m swagger_server
Steps to reproduce
Downloaded the python flask server stub from https://app.swaggerhub.com/apis/AnyVision/any-vision_api_documentation/1.20.2
Run pip3 install -r requirements.txt
Run python3 -m swagger_server
Related issues/PRs
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 reported generation with the AnyVision API definition, then inspect the generated swagger_server/models directory and controllers/camera_controller.py. Confirm why Binary is imported but no corresponding model is produced, and verify that the generated server starts successfully after the issue is corrected.
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
- Mostly clear
- Newbie friendliness
- 45/100