Skip to content

Commit f062e75

Browse files
committed
Add swagger response to tar_list method
1 parent 5ef8a0d commit f062e75

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/server/oasisapi/analyses/v2_api/viewsets.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
SUBTASK_STATUS_PARAM,
3434
SUBTASK_SLUG_PARAM,
3535
FILENAME_PARAM,
36+
FILE_LIST_RESPONSE,
3637
)
3738

3839

@@ -422,7 +423,7 @@ def input_file(self, request, pk=None, version=None):
422423
return handle_related_file(self.get_object(), 'input_file', request, ['application/x-gzip', 'application/gzip', 'application/x-tar', 'application/tar'])
423424

424425

425-
@swagger_auto_schema(methods=['get'])
426+
@swagger_auto_schema(methods=['get'], responses={200: FILE_LIST_RESPONSE})
426427
@action(methods=['get'], detail=True)
427428
def input_file_tar_list(self, request, pk=None, version=None):
428429
"""
@@ -526,7 +527,7 @@ def output_file(self, request, pk=None, version=None):
526527
"""
527528
return handle_related_file(self.get_object(), 'output_file', request, ['application/x-gzip', 'application/gzip', 'application/x-tar', 'application/tar'])
528529

529-
@swagger_auto_schema(methods=['get'])
530+
@swagger_auto_schema(methods=['get'], responses={200: FILE_LIST_RESPONSE})
530531
@action(methods=['get'], detail=True)
531532
def output_file_tar_list(self, request, pk=None, version=None):
532533
"""

src/server/oasisapi/schemas/custom_swagger.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
__all__ = [
22
'FILE_RESPONSE',
3+
'FILE_LIST_RESPONSE',
34
'HEALTHCHECK',
45
'TOKEN_REFRESH_HEADER',
56
'FILE_FORMAT_PARAM',
@@ -29,6 +30,14 @@
2930

3031
})
3132

33+
34+
FILE_LIST_RESPONSE = openapi.Response(
35+
'File List',
36+
schema = Schema(type=openapi.TYPE_ARRAY,
37+
items=Schema(title='File Name', type=openapi.TYPE_STRING))
38+
)
39+
40+
3241
HEALTHCHECK = Schema(
3342
title='HealthCheck',
3443
type='object',

0 commit comments

Comments
 (0)