swagger response togirlandi
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from .rest_framework import *
|
||||
from .corsheaders import *
|
||||
from .simple_jwt import *
|
||||
from .drf_yasg import *
|
||||
3
config/conf/drf_yasg.py
Normal file
3
config/conf/drf_yasg.py
Normal file
@@ -0,0 +1,3 @@
|
||||
SWAGGER_SETTINGS = {
|
||||
'DEFAULT_MODEL_RENDERING': 'example'
|
||||
}
|
||||
@@ -22,32 +22,30 @@ class LoginApiView(generics.GenericAPIView, ResponseMixin):
|
||||
serializer_class = LoginSerializer
|
||||
queryset = User.objects.all()
|
||||
|
||||
# @swagger_auto_schema(
|
||||
# operation_summary="Login",
|
||||
# responses={
|
||||
# 200: openapi.Response(
|
||||
# description="Success",
|
||||
# schema=openapi.Schema(
|
||||
# type=openapi.TYPE_OBJECT
|
||||
# ),
|
||||
# examples={
|
||||
# "application/json": {
|
||||
# "status_code": 200,
|
||||
# "status": "success",
|
||||
# "message": "User topildi",
|
||||
# "data": {
|
||||
# "id": 1,
|
||||
# "first_name": "Behruz",
|
||||
# "last_name": "Xoliqberdiyev",
|
||||
# "region": "nbve",
|
||||
# "is_active": True,
|
||||
# "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# )
|
||||
# }
|
||||
# )
|
||||
@swagger_auto_schema(
|
||||
operation_summary="Login",
|
||||
responses={
|
||||
200: openapi.Response(
|
||||
description="Success",
|
||||
schema=None,
|
||||
examples={
|
||||
"application/json": {
|
||||
"status_code": 200,
|
||||
"status": "success",
|
||||
"message": "User topildi",
|
||||
"data": {
|
||||
"id": 1,
|
||||
"first_name": "Behruz",
|
||||
"last_name": "Xoliqberdiyev",
|
||||
"region": "nbve",
|
||||
"is_active": True,
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
def post(self, request):
|
||||
try:
|
||||
serializer = self.serializer_class(data=request.data)
|
||||
|
||||
Reference in New Issue
Block a user