Skip to content

Commit

Permalink
Add missing integration instructions for drf-yasg (jazzband#505)
Browse files Browse the repository at this point in the history
* Add missing integration instructions for drf-yasg

* Add line break to the example code

Co-authored-by: 2ykwang <csdp000@naver.com>
  • Loading branch information
2ykwang and 2ykwang authored Jan 12, 2022
1 parent c75609c commit b29565b
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions docs/drf_yasg_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ following code to decorate your JWT ``View`` definitions.
from drf_yasg.utils import swagger_auto_schema
from rest_framework import serializers, status
from rest_framework_simplejwt.views import (
TokenObtainPairView, TokenRefreshView, TokenVerifyView)
TokenBlacklistView,
TokenObtainPairView,
TokenRefreshView,
TokenVerifyView,
)
class TokenObtainPairResponseSerializer(serializers.Serializer):
Expand All @@ -31,7 +35,9 @@ following code to decorate your JWT ``View`` definitions.
class DecoratedTokenObtainPairView(TokenObtainPairView):
@swagger_auto_schema(
responses={
status.HTTP_200_OK: TokenObtainPairResponseSerializer})
status.HTTP_200_OK: TokenObtainPairResponseSerializer,
}
)
def post(self, request, *args, **kwargs):
return super().post(request, *args, **kwargs)
Expand All @@ -49,7 +55,9 @@ following code to decorate your JWT ``View`` definitions.
class DecoratedTokenRefreshView(TokenRefreshView):
@swagger_auto_schema(
responses={
status.HTTP_200_OK: TokenRefreshResponseSerializer})
status.HTTP_200_OK: TokenRefreshResponseSerializer,
}
)
def post(self, request, *args, **kwargs):
return super().post(request, *args, **kwargs)
Expand All @@ -65,7 +73,27 @@ following code to decorate your JWT ``View`` definitions.
class DecoratedTokenVerifyView(TokenVerifyView):
@swagger_auto_schema(
responses={
status.HTTP_200_OK: TokenVerifyResponseSerializer})
status.HTTP_200_OK: TokenVerifyResponseSerializer,
}
)
def post(self, request, *args, **kwargs):
return super().post(request, *args, **kwargs)
class TokenBlacklistResponseSerializer(serializers.Serializer):
def create(self, validated_data):
raise NotImplementedError()
def update(self, instance, validated_data):
raise NotImplementedError()
class DecoratedTokenBlacklistView(TokenBlacklistView):
@swagger_auto_schema(
responses={
status.HTTP_200_OK: TokenBlacklistResponseSerializer,
}
)
def post(self, request, *args, **kwargs):
return super().post(request, *args, **kwargs)
Expand Down

0 comments on commit b29565b

Please sign in to comment.