Skip to content

Commit b45702e

Browse files
Marishka17Chris Lee-Messer
authored and
Chris Lee-Messer
committed
Added documentation for swagger page (cvat-ai#936)
1 parent 5b3c5ef commit b45702e

File tree

2 files changed

+170
-5
lines changed

2 files changed

+170
-5
lines changed

cvat/apps/authentication/views.py

+22
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
from . import forms
1414
from . import signature
1515

16+
from django.utils.decorators import method_decorator
17+
from drf_yasg.utils import swagger_auto_schema
18+
from drf_yasg import openapi
19+
1620
def register_user(request):
1721
if request.method == 'POST':
1822
form = forms.NewUserForm(request.POST)
@@ -27,7 +31,25 @@ def register_user(request):
2731
form = forms.NewUserForm()
2832
return render(request, 'register.html', {'form': form})
2933

34+
@method_decorator(name='post', decorator=swagger_auto_schema(
35+
request_body=openapi.Schema(
36+
type=openapi.TYPE_OBJECT,
37+
required=[
38+
'url'
39+
],
40+
properties={
41+
'url': openapi.Schema(type=openapi.TYPE_STRING)
42+
}
43+
),
44+
responses={'200': openapi.Response(description='text URL')}
45+
))
3046
class SigningView(views.APIView):
47+
"""
48+
This method signs URL for access to the server.
49+
50+
Signed URL contains a token which authenticates a user on the server.
51+
Signed URL is valid during 30 seconds since signing.
52+
"""
3153
def post(self, request):
3254
url = request.data.get('url')
3355
if not url:

0 commit comments

Comments
 (0)