pyeve / eve-swagger

Swagger extension for Eve-powered RESTful APIs
http://python-eve.org
Other
154 stars 43 forks source link

Allow basePath override #77

Closed lukemaxwell closed 5 years ago

lukemaxwell commented 5 years ago

I have python-eve behind an nginx reverse proxy, served at /api rather than /. However, the execution links in the basePath generated by eve-swagger is taken from URL_PREFIX, so excludes the /api and simply returns /.

This means that the Swagger UI does not work when executing the requests. Unfortunately, SwaggerUIBundle does not support setting a custom baseRef. I have solved this by declaring a new swagger route and hardcoding the basePath, however it seems like this is a common production use-case, so I'm wondering if there is a better way of achieving this?

Incidentally, on the Eve side, the paths are handled with this Flask snippet.

JoveYu commented 5 years ago

86

nicolaiarocci commented 5 years ago

re