0

When use drf-yasg or drf-spectacular,
is there any way to overwrite the default description shown in the sample picture
or does drf-yasg or drf-spectacular provide other language support for the default description?

I tried i18n support of drf-spectacular but I think it's not for this problem.
And to change the language_code settings of django is not work.

I appriciate your help very much.
sample1 sample2

Truemoonfans
  • 25
  • 1
  • 6

2 Answers2

1

This is just because django doesn't provide all the i18n messages for Japanese. By making up those messages will solve this problem.

Truemoonfans
  • 25
  • 1
  • 6
0
Installation:
drf-spectacular==0.22.0

You can override any parameters description part as:

from rest_framework.decorators import api_view
from drf_spectacular.utils import extend_schema, OpenApiParameter

@extend_schema(
summary="Sample API View",
parameters=[
        OpenApiParameter(name='param1', description='Here you can update param1 description'),
        OpenApiParameter(name='param2', description='Here you can update param2 description'),
    ],
description='More descriptive text yo can add, overrides default docstring extraction',
)
@api_view()
def sample_view(request):
    pass