OpenAPITools / OpenAPITools/openapi-generator
[feature-enhancement-request] models.one_ofintegernumber for python-flask
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
Why do I have the error
ModuleNotFoundError: No module named 'openapi_server.models.one_ofintegernumber'
when running the python-flask generated stub ?
I was expecting it to lauch a http server like it does for the petstore exemple.
openapi-generator version
I'm using the version 5.3.0-SNAPSHOT (after trying with latest stable)
OpenAPI declaration file content or url
I use the yaml from https://docs.kraken.com/rest/ that I validated with https://apidevtools.org/swagger-parser/online/
https://gist.github.com/maliky/03de5e2a1664ec8df5a665c517d0d151
Generation Details
I cloned the git repertory, compiled to use the latest and ran
java -jar openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g python-flask -i swagger-kraken-validated.json -o Og-latest-kraken -p legacyDiscriminatorBehavior=false
then in a virtualenv with the requirements installed I run
python -m openapi_server
Full traceback
Traceback (most recent call last):
File "/home/mlk/.pyenv/versions/3.8.2/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/mlk/.pyenv/versions/3.8.2/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/mlk/Prog/Python/Crypto/API/Swagger-OpenAPI/Og-latest-kraken/openapi_server/__main__.py", line 5, in <module>
from openapi_server import encoder
File "/home/mlk/Prog/Python/Crypto/API/Swagger-OpenAPI/Og-latest-kraken/openapi_server/encoder.py", line 4, in <module>
from openapi_server.models.base_model_ import Model
File "/home/mlk/Prog/Python/Crypto/API/Swagger-OpenAPI/Og-latest-kraken/openapi_server/models/__init__.py", line 8, in <module>
from openapi_server.models.asset_pair import AssetPair
File "/home/mlk/Prog/Python/Crypto/API/Swagger-OpenAPI/Og-latest-kraken/openapi_server/models/asset_pair.py", line 9, in <module>
from openapi_server.models.one_ofintegernumber import OneOfintegernumber
ModuleNotFoundError: No module named 'openapi_server.models.one_ofintegernumber'
Steps to reproduce
Try to generate server python-flask stub from the given json file.
Related issues/PRs
Did not find any
Suggest a fix
Looks like some typing hint not working as expected ?
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
Reproduce with the provided Kraken specification and the python-flask generation command, then inspect the generated openapi_server/models/asset_pair.py import and models/init.py loading path. Done means the generated package no longer imports a missing one_ofintegernumber module and python -m openapi_server can launch the server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, java, openapi, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100