shuiqiang
shuiqiang

Reputation: 437

drf-yasg how to display the api description outside?

I want the describe in there:
picture 1
but mine is in there:
picture 2
This is my code:

@swagger_auto_schema(method='GET', manual_parameters=[project_param])
@api_view(['GET'])
def get_project_info(request):
    """
    获取项目信息
    """

Version info:
Django==2.2.1
drf-yasg==1.16.1

Upvotes: 0

Views: 960

Answers (2)

Naganohara Yoimiya
Naganohara Yoimiya

Reputation: 11

you can use swagger_auto_schema decorator to display id, summary and description.

from drf_yasg.utils import swagger_auto_schema

class ProductOperation(ModelViewSet):
    @swagger_auto_schema(
        operation_id='Display end of opblock',
        operation_summary="Display outside",
        operation_description='Display inside',
    )
    def action_one(self, request):
        dosomething()

looks like this

Upvotes: 1

Hamed Rostami
Hamed Rostami

Reputation: 1678

if Docstring used in below format description will be available in there:

class ProductOperation(ModelViewSet):
   """
   Outside

   Inside

   """

enter image description here

Upvotes: 3

Related Questions