pyeve / eve-swagger

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

Changing index route from '/api-docs' to '/' #33

Closed pdecat closed 6 years ago

pdecat commented 7 years ago

Hi,

what about mapping the index endpoint on the / route instead of /api-docs letting the embedding app to map wherever it likes with url_prefix?

diff --git a/eve_swagger/swagger.py b/eve_swagger/swagger.py
index e90f374..0b5941c 100644
--- a/eve_swagger/swagger.py
+++ b/eve_swagger/swagger.py
@@ -81,7 +81,7 @@ def _modify_response(f):
     return decorated

-@swagger.route('/api-docs')
+@swagger.route('/')
 @_modify_response
 def index():
     def node(parent, key, value):

If I submitted such a PR, would it get accepted or are there any reason not doing so in the first place?

Best regards, Patrick.

pdecat commented 7 years ago

My work-around for now is to add an additional URL rule:

from eve import Eve
from eve_swagger import swagger

myapp = Eve()
myapp.register_blueprint(swagger, url_prefix='/docs/api')
myapp.add_url_rule('/docs/api', 'eve_swagger.index')
stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.