-
Notifications
You must be signed in to change notification settings - Fork 602
URLs by router are not detected by swagger #479
Comments
Checked this out. Quick suggestion is to write a schema view as shown in the quick start example. It is possible to get this working with a router, but DRF does not yet fully support the SwaggerUIRenderer as the root view renderer when used on the However, you can get it "almost" working with the default router if you do the following: router = DefaultRouter(
schema_title='Pastebin API',
schema_renderers=[OpenAPIRenderer, SwaggerUIRenderer]
) |
Then, from the browser, you will need to add Ideally, we'd want to be able to set the SwaggerUIRenderer as the root view's renderer, not just the schema, but that currently is not possible |
@marcgibbons thanks for your comments I've created the schema view as the quick start example and mapped to I'm using a custom router (inherit from SimpleRouter) so the I'm not sure what to try now. The link you pointed me on django-restframework doesn't work. Taking advance on this discussion I want to ask you: how are we going to customize the documentation if YAML is not supported anymore? I didn't found anything in the new documentation. |
@humitos If you are using the DefaultRouter as the schema source, then you will not need the schema_view. Have you tried running the example_app included in this project? The urls.py can be modified to use the DefaultRouter as the serving point for the docs. router = DefaultRouter(
schema_title='Pastebin API',
schema_renderers=[OpenAPIRenderer, SwaggerUIRenderer]
)
router.register(r'snippets', views.SnippetViewSet)
router.register(r'users', views.UserViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
] Then, to view, you would open As for customization, the idea is that we are pushing this responsibility up to DRF. I do plan on implementing a feature which would allow the inclusion of OpenAPI |
I have the same problem. I followed the instructions in this discussion but it still doesn't work. I get these other errors now. |
I just stumbled upon this issue. Using |
@humitos @marcgibbons this seems to be addressed as well, can we close it? |
Hi, after upgrading to django-rest-swagger 2.0 my url defined by the router are not detected
Then, when I hit
/docs
I only see the documentation for/docs
endpoint.What I am doing wrong?
I was working properly with the previous version of django-rest-swagger.
The text was updated successfully, but these errors were encountered: