Skip to content

Commit 0e7f466

Browse files
committed
fix: text to speech doc show request body
【【github#2032 】【swagger 文档】/api/application/application_id/text to_speech 接口缺少文件上传的入口参数】 https://www.tapd.cn/57709429/bugtrace/bugs/view/1157709429001051530
1 parent ff3f511 commit 0e7f466

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

apps/application/swagger_api/application_api.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,25 @@ def get_request_params_api():
401401
description=_('Application ID')),
402402

403403
]
404+
405+
class TextToSpeech(ApiMixin):
406+
@staticmethod
407+
def get_request_params_api():
408+
return [openapi.Parameter(name='application_id',
409+
in_=openapi.IN_PATH,
410+
type=openapi.TYPE_STRING,
411+
required=True,
412+
description=_('Application ID')),
413+
414+
]
415+
416+
@staticmethod
417+
def get_request_body_api():
418+
return openapi.Schema(
419+
type=openapi.TYPE_OBJECT,
420+
required=[],
421+
properties={
422+
'text': openapi.Schema(type=openapi.TYPE_STRING, title=_("Text"),
423+
description=_("Text")),
424+
}
425+
)

apps/application/views/application_views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,12 @@ class TextToSpeech(APIView):
629629
authentication_classes = [TokenAuth]
630630

631631
@action(methods=['POST'], detail=False)
632+
@swagger_auto_schema(operation_summary=_("text to speech"),
633+
operation_id=_("text to speech"),
634+
manual_parameters=ApplicationApi.TextToSpeech.get_request_params_api(),
635+
request_body=ApplicationApi.TextToSpeech.get_request_body_api(),
636+
responses=result.get_default_response(),
637+
tags=[_('Application')])
632638
@has_permissions(
633639
ViewPermission([RoleConstants.ADMIN, RoleConstants.USER, RoleConstants.APPLICATION_ACCESS_TOKEN],
634640
[lambda r, keywords: Permission(group=Group.APPLICATION,

0 commit comments

Comments
 (0)