-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Error running python-flask server generated with openapi-generator-cli-3.0.0.jar. #323
Comments
@fjd1234 Thanks for reporting this issue. I've also tried to run python-flask stub (latest master) and got similar errors you reported. $ cd openapi-generator
$ bin/python-flask-petstore-python2.sh
$ cd samples/server/petstore/flaskConnexion-python2/
$ pip install -r requirements.txt
$ python -m openapi_server
Traceback (most recent call last):
File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
...
...
...
<ValidationError: "'swagger' is a required property">) It may caused by the two stuff below:
|
Indeed, we generate an OAIv3 yaml but flask-connexion doesn't support it yet. |
So the issue seems to be that connexion doesn't support openapi v3 and a suggested solution would be to use a mustache tag that conatains v2 version. How would I do this? I'd like to use this codegen to generate python-flask code for v3 specs. Thanks |
Still the same error with 3.2.2 of the generator. I couldn't find any documentation on how to make openapi generator work with python-flask with any version of the spec. To avoid confusion, I would propose to remove "python-flask" from the list of the generators on the home page. |
I would also like the ability to generate a OAIv2/Swagger v2 spec until such a time as connexion can fully support v3 |
Here is the PR to support OpenAPI spec v3 in connexion: spec-first/connexion#621 |
The PR has been merged and will be part of connexion 2.0 : https://github.com/zalando/connexion/milestone/10 |
Use the dev-2.0 git branch of flask connexion to fix the generator. This is not ideal but better than a generator not working at all. Fix OpenAPITools#323
Use the dev-2.0 git branch of flask connexion to fix the generator. This is not ideal but better than a generator not working at all. Fix #323
UPDATE: @cbornet has made a fix (workaround) to the Python Flask generator before connexion 2.0 is officially released. Please give it a try by using the SNAPSHOT version or the docker image. We'll close this issue once we update Python Flask generator to use connexion 2.0 stable release. |
Use the dev-2.0 git branch of flask connexion to fix the generator. This is not ideal but better than a generator not working at all. Fix OpenAPITools#323
The Python flask generator has been updated to use flask-connexion 2.0.0 stable version. Please pull the latest master to give it a try. |
Use the dev-2.0 git branch of flask connexion to fix the generator. This is not ideal but better than a generator not working at all. Fix OpenAPITools#323
I've generated python-flask SDK from petstore.yaml and hit the run time error summarized below. This worked fine with the swager-codegen and it seems "openapi" components is not found. It used to be "swagger". Maybe I'm missing some plugin or need a newer python? Any suggestions?
I've attached the complete backtrace.
Thanks
Frank
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/swagger_spec_validator/common.py", line 24, in wrapper
return method(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/swagger_spec_validator/validator20.py", line 141, in validate_json
cls=Draft4Validator,
File "/usr/lib/python3.5/site-packages/swagger_spec_validator/ref_validators.py", line 53, in validate
instance_cls(schema, *args, **kwargs).validate(instance)
File "/usr/lib/python3.5/site-packages/jsonschema/validators.py", line 130, in validate
raise error
jsonschema.exceptions.ValidationError: 'components', 'openapi', 'servers' do not match any of the regexes: '^x-'
Suggest a fix/enhancement
petstore_flask.txt
The text was updated successfully, but these errors were encountered: