Skip to content

Commit

Permalink
Hide user endpoints in Swagger API documentation
Browse files Browse the repository at this point in the history
The user namespace is added to the user URLs, which, because of our
Swagger configuration, prevents the URLs from showing up in the
documentation.

This was originally added in #2227, but it broke compatibility with
ITSI and was removed in #2377.

The namespace is added here again along with a fix to the ITSI login view.
When calling reverse on a URL which is included in a namespace, the
namespace must also be added to the reverse parameter. See
https://stackoverflow.com/a/38390178/217378.

Refs #2401
  • Loading branch information
caseycesari committed Oct 25, 2017
1 parent 2dc52e9 commit 63e175d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mmw/apps/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def logout(request):

def itsi_login(request):
redirect_uri = '{0}?next={1}'.format(
request.build_absolute_uri(reverse(itsi_auth)),
request.build_absolute_uri(reverse('user:itsi_auth')),
request.GET.get('next', '/')
)
params = {'redirect_uri': redirect_uri}
Expand Down
3 changes: 2 additions & 1 deletion src/mmw/mmw/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
namespace='mmw')),
url(r'^api/', include(apps.geoprocessing_api.urls)),
url(r'^micro/', include(apps.water_balance.urls)),
url(r'^user/', include(apps.user.urls))
url(r'^user/', include(apps.user.urls,
namespace='user'))
)

0 comments on commit 63e175d

Please sign in to comment.