-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger UI cannot expand operations #1
Comments
I looks as if the JavaScript sources did not load correctly. Are you seeing any errors in the Console or Network tabs of Dev Tools? |
Nope, that was the idea of my animated gif, that you can see that there are no errors. For me the URL pattern issues for Swagger seems related on how flask-restplus is used in combination with Blueprint. As soon as I initialize the API without Blueprint, Swagger UI is happy. |
So far, i was unable to reproduce your problem. Could you perhaps submit a pull request with the change you had to make to fix it? |
I had the same issue, I resolved it by using the requirements.txt package version for flask-restplus, I had been using the most recent pip install version. |
Possibly related to: noirbizarre/flask-restplus#278 |
FYI it looks like the flask-restplus issue mentioned in the last comment is also breaking bravado client generation (see noirbizarre/flask-restplus#278 (comment) ) It seems like an upstream issue, but could be worth fixing here as this tutorial is high up on search indexes for "Flask REST Swagger", and client generation is one of the main reasons to use Swagger. This is a workaround: diff --git a/rest_api_demo/api/blog/endpoints/categories.py b/rest_api_demo/api/blog/endpoints/categories.py
index 140d173..c974f56 100644
--- a/rest_api_demo/api/blog/endpoints/categories.py
+++ b/rest_api_demo/api/blog/endpoints/categories.py
@@ -9,7 +9,7 @@ from rest_api_demo.database.models import Category
log = logging.getLogger(__name__)
-ns = api.namespace('blog/categories', description='Operations related to blog categories')
+ns = api.namespace('blog_categories', path='/blog/categories', description='Operations related to blog categories')
@ns.route('/')
diff --git a/rest_api_demo/api/blog/endpoints/posts.py b/rest_api_demo/api/blog/endpoints/posts.py
index 0294c18..95f0313 100644
--- a/rest_api_demo/api/blog/endpoints/posts.py
+++ b/rest_api_demo/api/blog/endpoints/posts.py
@@ -10,7 +10,7 @@ from rest_api_demo.database.models import Post
log = logging.getLogger(__name__)
-ns = api.namespace('blog/posts', description='Operations related to blog posts')
+ns = api.namespace('blog_posts', path='/blog/posts', description='Operations related to blog posts')
@ns.route('/') |
When trying to click on an operation (for example "get posts") Swagger is not able to expand the details, but seems to try to open an non-existant URL: http://localhost:8888/api/#!/blog%2Fposts/get_posts_collection
The text was updated successfully, but these errors were encountered: