Giter Club home page Giter Club logo

Comments (5)

vemonet avatar vemonet commented on June 15, 2024

Issue with Connexion default behavior. Multiple issues have been created but the default behavior is to override servers whatever the situation, and Connexion do not seems to provide ways to make sure the servers defined by the user in the openapi.yml file

spec-first/connexion#1174
spec-first/connexion#1139
spec-first/connexion#1047

The culprit: https://github.com/zalando/connexion/blob/master/connexion/apis/flask_api.py#L310

It can be solved by adding a param to disable _spec_for_prefix

An options like self.options.openapi_spec_path

self.options.disable_servers_overwrite = True

Then check it in _spec_for_prefix

from translator-openpredict.

vemonet avatar vemonet commented on June 15, 2024

Using https://pypi.org/project/flask-reverse-proxy-fix/ can help solve the issue

requirements.txt:

flask-reverse-proxy-fix
werkzeug<1

Code:

from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix

api = connexion.App(__name__, options={"swagger_url": ""}, arguments={'server_url': server_url})

api.add_api('openapi.yml')

api.app.config['REVERSE_PROXY_PATH'] = 'http://api.collaboratory.semantiscience.org'
ReverseProxyPrefixFix(api.app)

api.run(host='0.0.0.0', port=port, debug=debug, server=deployment_server)

from translator-openpredict.

micheldumontier avatar micheldumontier commented on June 15, 2024

Great! but the server url is misspelled .

from translator-openpredict.

vemonet avatar vemonet commented on June 15, 2024

Yep it works with absolute URIs and relative paths(e.g. /api or v1)

Going to try it with Smart API

from translator-openpredict.

vemonet avatar vemonet commented on June 15, 2024

Smart API still not working even with absolute URL: https://smart-api.info/ui/ff8e602615d19577fa3759240dcce951

from translator-openpredict.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.