Yet another Swagger generator


๐Ÿ’ก drf_yasg

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

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

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

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