예시
@swagger_auto_schema(
operation_id="구글 로그인 콜백",
operation_description="구글에서 반환한 인증 코드를 넣으면, 회원가입 or 로그인 후 서버 토큰 리턴\n"
"닉네임이 없으면 message를 True 반환\n"
"True면 닉네임, 프로필, 이름, 한줄 소개 업데이트",
tags=['소셜 로그인'],
manual_parameters=[
openapi.Parameter(
'code',
in_=openapi.IN_QUERY,
description='구글에서 반환한 인증 코드',
type=openapi.TYPE_STRING,
required=True,
),
],
)
프로젝트에서 사용한 구글 로그인 인증 코드를 입력하면 로그인 or 회원가입을 진행해주는 스웨거 부분이다.
Viewsets을 사용할 경우 메서드 하나하나 전부 메소드를 호출해서 스웨거를 등록해줘야한다.
추가적으로 추가할 데코레이터와 파라미터 스키마 같이 수정해야할 부분이 있으면 아래 링크를 들어가서 참고하면 될 것 같다.
참고
drf_yasg package — drf-yasg 1.21.7 documentation
the return value of the winning inspector, or None if no inspector handled the object
drf-yasg.readthedocs.io
https://drf-yasg.readthedocs.io/en/stable/custom_spec.html
Custom schema generation — drf-yasg 1.21.7 documentation
for ViewSet, GenericViewSet, ModelViewSet, because each viewset corresponds to multiple paths, you have to decorate the action methods, i.e. list, create, retrieve, etc. Additionally, @actions defined on the viewset, like function based api views, can resp
drf-yasg.readthedocs.io
'Django > API Docs' 카테고리의 다른 글
[Postman] CSRFToken 에러 해결 하기, 최신버전 (0) | 2024.11.04 |
---|---|
[Postman] Swagger와 차이점 및 Postman으로 API 문서 작성 (0) | 2024.04.16 |
DRF drf-yasg swaager access token(JWT) 입력 받기 (0) | 2024.03.20 |
DRF API Document drf-spectacular (0) | 2023.11.27 |
Django 프로젝트에 Swagger 적용하기 (0) | 2023.05.03 |
예시
@swagger_auto_schema(
operation_id="구글 로그인 콜백",
operation_description="구글에서 반환한 인증 코드를 넣으면, 회원가입 or 로그인 후 서버 토큰 리턴\n"
"닉네임이 없으면 message를 True 반환\n"
"True면 닉네임, 프로필, 이름, 한줄 소개 업데이트",
tags=['소셜 로그인'],
manual_parameters=[
openapi.Parameter(
'code',
in_=openapi.IN_QUERY,
description='구글에서 반환한 인증 코드',
type=openapi.TYPE_STRING,
required=True,
),
],
)
프로젝트에서 사용한 구글 로그인 인증 코드를 입력하면 로그인 or 회원가입을 진행해주는 스웨거 부분이다.
Viewsets을 사용할 경우 메서드 하나하나 전부 메소드를 호출해서 스웨거를 등록해줘야한다.
추가적으로 추가할 데코레이터와 파라미터 스키마 같이 수정해야할 부분이 있으면 아래 링크를 들어가서 참고하면 될 것 같다.
참고
drf_yasg package — drf-yasg 1.21.7 documentation
the return value of the winning inspector, or None if no inspector handled the object
drf-yasg.readthedocs.io
https://drf-yasg.readthedocs.io/en/stable/custom_spec.html
Custom schema generation — drf-yasg 1.21.7 documentation
for ViewSet, GenericViewSet, ModelViewSet, because each viewset corresponds to multiple paths, you have to decorate the action methods, i.e. list, create, retrieve, etc. Additionally, @actions defined on the viewset, like function based api views, can resp
drf-yasg.readthedocs.io
'Django > API Docs' 카테고리의 다른 글
[Postman] CSRFToken 에러 해결 하기, 최신버전 (0) | 2024.11.04 |
---|---|
[Postman] Swagger와 차이점 및 Postman으로 API 문서 작성 (0) | 2024.04.16 |
DRF drf-yasg swaager access token(JWT) 입력 받기 (0) | 2024.03.20 |
DRF API Document drf-spectacular (0) | 2023.11.27 |
Django 프로젝트에 Swagger 적용하기 (0) | 2023.05.03 |