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

Added documentation for swagger page #936

Merged
merged 8 commits into from
Dec 18, 2019
Merged
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
22 changes: 22 additions & 0 deletions cvat/apps/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
from . import forms
from . import signature

from django.utils.decorators import method_decorator
from drf_yasg.utils import swagger_auto_schema
from drf_yasg import openapi

def register_user(request):
if request.method == 'POST':
form = forms.NewUserForm(request.POST)
Expand All @@ -27,7 +31,25 @@ def register_user(request):
form = forms.NewUserForm()
return render(request, 'register.html', {'form': form})

@method_decorator(name='post', decorator=swagger_auto_schema(
request_body=openapi.Schema(
type=openapi.TYPE_OBJECT,
required=[
'url'
],
properties={
'url': openapi.Schema(type=openapi.TYPE_STRING)
}
),
responses={'200': openapi.Response(description='text URL')}
))
class SigningView(views.APIView):
"""
This method signs URL for access to the server.

Signed URL contains a token which authenticates a user on the server.
Signed URL is valid during 30 seconds since signing.
"""
def post(self, request):
url = request.data.get('url')
if not url:
Expand Down
Loading