ํฌ์ŠคํŠธ

Yet another Swagger generator

Yet another Swagger generator

๐Ÿ’ก drf_yasg

ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ํ•„์š”ํ•œ GET์š”์ฒญ์„ ํ•  ๋•Œ๋Š” ์Šคํ‚ค๋งˆ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค๊ณ  ํ•œ๋‹ค.

๋งŒ์•ฝ, ํŒŒ๋งˆ๋ฆฌํ„ฐ๊ฐ€ ๋”ฐ๋กœ ์—†๋‹ค๋ฉด, class ์™€ def ์‚ฌ์ด์— ์žˆ๋Š” ์ฝ”๋“œ๋Š” ์ž‘์„ฑํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค.

์ƒ์†๋ฐ›๋Š” ํด๋ž˜์Šค๋Š” APIView์ด์–ด์•ผ ํ•œ๋‹ค. (APIView๋ฅผ ์ƒ์†๋ฐ›๋Š” ํด๋ž˜์Šค๋„ ๊ฐ€๋Šฅ)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class VerifyEmail(views.APIView):
    serializer_class = EmailVerificationSerializer
    
    # ํŒŒ๋ผ๋ฏธํ„ฐ ์„ค์ •.
    token_param_config = openapi.Parameter(
        'token',
        in_=openapi.IN_QUERY, 
        description='Bearer token',
        type=openapi.TYPE_STRING
    )

    @swagger_auto_schema(manual_parameters=[token_param_config])
    def get(self, request):
        pass


๐Ÿ“š References

์ด ๊ธฐ์‚ฌ๋Š” ์ €์ž‘๊ถŒ์ž์˜ CC BY 4.0 ๋ผ์ด์„ผ์Šค๋ฅผ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค.