You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working with the OpenTripModel OpenAPI yaml and generating a server using openapi-generator (v4.0.0) does not seem to work and gives a connexion error.
Trying to run the server gives the following error: Traceback (most recent call last): File "c:\python37\Lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "c:\python37\Lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Julian\Downloads\server\openapi_server\__main__.py", line 18, in <module> main() File "C:\Users\Julian\Downloads\server\openapi_server\__main__.py", line 13, in main pythonic_params=True) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apps\flask_app.py", line 54, in add_api api = super(FlaskApp, self).add_api(specification, **kwargs) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apps\abstract.py", line 155, in add_api options=api_options.as_dict()) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apis\abstract.py", line 72, in __init__ self.specification = Specification.load(specification, arguments=arguments) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 151, in load return cls.from_file(spec, arguments=arguments) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 108, in from_file return cls.from_dict(spec) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 146, in from_dict return OpenAPISpecification(spec) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 39, in __init__ self._validate_spec(raw_spec) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 232, in _validate_spec raise InvalidSpecification.create_from(e) connexion.exceptions.InvalidSpecification: Required list has not defined properties: ['type']
Expected behaviour
The server should run, but it doesn't. The SwaggerHub editor says the code is valid.
Running openapi-spec-validator also gives the same error. However, other validators say it is valid. And neither openapi-spec-validator nor connexion give the exact location of the error, so I don't know where it is and how to fix it.
Actual behaviour
Generating the server seems to work fine, although running it gives the error connexion.exceptions.InvalidSpecification: Required list has not defined properties: ['type']
Description
Working with the OpenTripModel OpenAPI yaml and generating a server using openapi-generator (v4.0.0) does not seem to work and gives a connexion error.
Trying to run the server gives the following error:
Traceback (most recent call last): File "c:\python37\Lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "c:\python37\Lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Julian\Downloads\server\openapi_server\__main__.py", line 18, in <module> main() File "C:\Users\Julian\Downloads\server\openapi_server\__main__.py", line 13, in main pythonic_params=True) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apps\flask_app.py", line 54, in add_api api = super(FlaskApp, self).add_api(specification, **kwargs) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apps\abstract.py", line 155, in add_api options=api_options.as_dict()) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apis\abstract.py", line 72, in __init__ self.specification = Specification.load(specification, arguments=arguments) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 151, in load return cls.from_file(spec, arguments=arguments) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 108, in from_file return cls.from_dict(spec) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 146, in from_dict return OpenAPISpecification(spec) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 39, in __init__ self._validate_spec(raw_spec) File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\spec.py", line 232, in _validate_spec raise InvalidSpecification.create_from(e) connexion.exceptions.InvalidSpecification: Required list has not defined properties: ['type']
Expected behaviour
The server should run, but it doesn't. The SwaggerHub editor says the code is valid.
Running openapi-spec-validator also gives the same error. However, other validators say it is valid. And neither openapi-spec-validator nor connexion give the exact location of the error, so I don't know where it is and how to fix it.
Actual behaviour
Generating the server seems to work fine, although running it gives the error
connexion.exceptions.InvalidSpecification: Required list has not defined properties: ['type']
Steps to reproduce
Download the OpenTripModel openapi spec: https://raw.githubusercontent.com/opentripmodel/opentripmodel/master/api/swagger.yaml
Install generator using NPM
npm install @openapitools/openapi-generator-cli -g
Run the generator on the swagger.yaml file into ./server/ dir
openapi-generator generate -i .\swagger.yaml -g python-flask -o .\server
Move into new server dir
cd server
Install requirements
pip3 install -r requirements.txt
Run server
python3 -m openapi_server
And it should give the error.
Additional info:
Output of the commands:
python --version
Python 3.7.3
pip show connexion | grep "^Version\:"
On a Windows system so grep doesn't work, but connexion version is 2.0.2 according to Pipfile
The text was updated successfully, but these errors were encountered: