Skip to content

Possible Connexion Swagger Parsing Issue #557

@jcantu-usgs

Description

@jcantu-usgs

swagger_server.zip

Description

I have a swagger yaml doc that I generated python-flask code for on the editor.swagger.io site. When I have no SQLAlchemy code in my models, it all starts up fine. The minute I try to tie the model to a table I get an error. Depending on whether I use 1.1.9 or 1.2, the error is different.

Version 1.1.9 yields this error:

  File "/Users/jcantu/Projects/files-api/api/venv/lib/python3.6/site-packages/connexion/resolver.py", line 39, in resolve
    return Resolution(self.resolve_function_from_operation_id(operation_id), operation_id)
  File "/Users/jcantu/Projects/files-api/api/venv/lib/python3.6/site-packages/connexion/resolver.py", line 68, in resolve_function_from_operation_id
    raise ResolverError(msg)
connexion.exceptions.ResolverError: <ResolverError: Cannot resolve operationId "swagger_server.controllers.file_service_controller.get_service"!>

Version 1.2 yields this error:

  File "/Users/jcantu/Projects/files-api/api/venv/lib/python3.6/site-packages/sqlalchemy/ext/declarative/base.py", line 437, in _setup_table
    **table_kw)
  File "/Users/jcantu/Projects/files-api/api/venv/lib/python3.6/site-packages/flask_sqlalchemy/model.py", line 89, in __table_cls__
    if key in cls.metadata.tables:
AttributeError: 'property' object has no attribute 'tables'


Expected behaviour

My Connexion Flask app starts normally.

Actual behaviour

As soon as connexion reads the swagger.yaml doc (on line 20 of main.py), we have a failure.

Steps to reproduce

See the attached flask project (zipped)
swagger_server.zip
Also, here's a docker image for the database:
database.zip

Additional info:

Output of the commands:

  • python --version
  • pip show connexion | grep "^Version\:"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions