Skip to content
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

Add support for documenting API #104

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ lxml==4.2.5
social-auth-app-django==2.1.0
#for testing
selenium==3.14.1
drf-yasg==1.14.0
1 change: 1 addition & 0 deletions src/src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
'api',
'rest_framework',
'social_django',
'drf_yasg',
]

MIDDLEWARE = [
Expand Down
16 changes: 16 additions & 0 deletions src/src/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,20 @@
from django.conf.urls.static import static
from rest_framework import routers
from api import views
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi

schema_view = get_schema_view(
openapi.Info(
title="SPDX Online Tools API",
default_version='v1',
description="API Documentation for SPDX Online Tools used to understand the capabilities of the \
tools by testing the requests and responses of the various API endpoints."
),
public=True,
permission_classes=(permissions.AllowAny,),
)

router = routers.DefaultRouter()
#router.register(r'users', views.UserViewSet)
Expand All @@ -53,6 +66,9 @@
url(r'^api2/', include(router.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^oauth/', include('social_django.urls', namespace='social')),
url(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
]

urlpatterns += staticfiles_urlpatterns()
Expand Down