Created
April 18, 2021 04:24
-
-
Save KimSoungRyoul/b67636ae8bb0d193a0c4beff4bc1a6e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extend_schema( | |
tags=["사용자"], | |
summary="method레벨 데코레이터도 가능", | |
examples=[ | |
OpenApiExample( | |
name="success_example", | |
value={ | |
"username": "root", | |
"password": "django_1234", | |
"first_name": "성렬", | |
"last_name": "김", | |
"email": "[email protected]", | |
}, | |
), | |
OpenApiExample( | |
request_only=True, # 요청시에만 사용가능한 예제로 명시한다. | |
summary="비밀번호 너무 쉬움 예제", | |
name="invalid_example1", | |
value={ | |
"username": "root23", | |
"password": "1234", | |
"first_name": "성렬", | |
"last_name": "김", | |
"email": "[email protected]", | |
}, | |
), | |
OpenApiExample( | |
request_only=True, | |
summary="이름 필수 입력 예제", | |
name="invalid_example2", | |
value={ | |
"username": "root434", | |
"password": "django_1234", | |
"first_name": "", | |
"last_name": "김", | |
"email": "[email protected]", | |
}, | |
), | |
OpenApiExample( | |
response_only=True, # 응답시에만 사용가능한 예제로 명시한다. | |
name="success_example2", | |
value={ | |
"username": "root434", | |
"password": "django_1234", | |
"first_name": "성렬", | |
"last_name": "김", | |
"email": "[email protected]", | |
}, | |
), | |
], | |
) | |
def create(self, request: Request, *args, **kwargs) -> Response: | |
# .... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment