title: Integrating Swagger/OpenAPI generated python server with existing Flask application
body: <p>I am interested in integrating a <code>swagger-codegen</code> generated Python server with an existing Flask application.  <a href="https://github.com/swagger-api/swagger-codegen" rel="noreferrer"><code>swagger-codegen</code></a> generates a Python implementation based on the <a href="https://github.com/zalando/connexion/" rel="noreferrer"><code>Connexion</code></a> library from a <a href="http://swagger.io/specification/" rel="noreferrer"><code>Swagger API specification</code></a>.</p>
  
  <p>The <a href="https://github.com/zalando/connexion/tree/master/examples" rel="noreferrer">examples</a> I have found all seem to expect that <a href="https://github.com/zalando/connexion/blob/master/connexion/app.py" rel="noreferrer"><code>connexion.App</code></a> manages the entire <code>flask</code> application.  </p>
  
  <pre><code>import connexion
  
  app = connexion.App(__name__, specification_dir='swagger/')
  app.add_api('my_api.yaml')
  app.run(port=8080)
  </code></pre>
  
  <p>However, I have existing blueprints, config and sqlalchemy models I would like to integrate with the generated Connexion API.  It looks like <code>connexion.App.app</code> is the underlying Flask app.  One option might be to reach in and extend the Connexion Flask application, perhaps something like this: </p>
  
  <pre><code>import connexion
  
  app = connexion.App(__name__, specification_dir='swagger/')
  
  app.app.config.from_pyfile('...')
  db.init_app(app.app)
  for blueprint in my_blueprints:
      app.app.register_blueprint(blueprint)
  
  app.add_api('my_api.yaml')
  
  app.run(port=8080)
  </code></pre>
  
  <p>Trying to piggyback on the heavily customized Connexion Flask app seems simpler than integrating the bare blueprint from <a href="https://github.com/zalando/connexion/blob/master/connexion/api.py" rel="noreferrer"><code>connexion.Api</code></a> into my existing Flask app.  However, I cannot easily tell whether Connexion is designed to play nicely with non-Connexion managed blueprints.</p>
  
  <p>What is the best way to integrate the Connexion Swagger defined API within an existing, traditional Flask application?  Has anyone gone down this path?</p>