diff options
author | hongyuzhao <zhao.hongyu@zte.com.cn> | 2019-11-27 10:49:38 +0800 |
---|---|---|
committer | hongyuzhao <zhao.hongyu@zte.com.cn> | 2019-11-27 10:55:14 +0800 |
commit | 8bd492a4918a6692d36f1e1e766c7e3a88e56084 (patch) | |
tree | 028fb66f965346be4a3d3fe8d35c825e60dacd0e /catalog/packages/views | |
parent | b301e35367f860fae335c85227795008b531d79b (diff) |
Swagger issue fixes from the Ericsson team
Change-Id: I4fb7609292101e9c0c44b38ec8d40657bd340460
Issue-ID: MODELING-288
Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
Diffstat (limited to 'catalog/packages/views')
-rw-r--r-- | catalog/packages/views/pnf_descriptor_views.py | 8 | ||||
-rw-r--r-- | catalog/packages/views/vnf_package_views.py | 13 |
2 files changed, 16 insertions, 5 deletions
diff --git a/catalog/packages/views/pnf_descriptor_views.py b/catalog/packages/views/pnf_descriptor_views.py index 9e7a2c4..1fa03dc 100644 --- a/catalog/packages/views/pnf_descriptor_views.py +++ b/catalog/packages/views/pnf_descriptor_views.py @@ -19,6 +19,7 @@ from drf_yasg.utils import no_body, swagger_auto_schema from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response +from drf_yasg import openapi from catalog.packages.biz.pnf_descriptor import PnfDescriptor from catalog.packages.const import TAG_PNFD_API, TAG_PARSER_API @@ -125,10 +126,13 @@ def pnf_descriptors_rc(request): tags=[TAG_PNFD_API], request_body=no_body, responses={ - status.HTTP_204_NO_CONTENT: 'PNFD file', + status.HTTP_200_OK: openapi.Response('PNFD file', schema=openapi.Schema(format=openapi.FORMAT_BINARY, + type=openapi.TYPE_STRING)), status.HTTP_404_NOT_FOUND: ProblemDetailsSerializer(), status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer() - } + }, + produces='application/octet-stream', + operation_id='Fetch PNFD content' ) @api_view(http_method_names=['PUT', 'GET']) @view_safe_call_with_log(logger=logger) diff --git a/catalog/packages/views/vnf_package_views.py b/catalog/packages/views/vnf_package_views.py index 6747269..5fca931 100644 --- a/catalog/packages/views/vnf_package_views.py +++ b/catalog/packages/views/vnf_package_views.py @@ -16,6 +16,7 @@ import logging from django.http import StreamingHttpResponse from drf_yasg.utils import swagger_auto_schema, no_body +from drf_yasg import openapi from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response @@ -79,10 +80,14 @@ def vnf_packages_rc(request): tags=[TAG_VNF_PACKAGE_API], request_body=no_body, responses={ - status.HTTP_200_OK: VnfPkgInfosSerializer(), + status.HTTP_200_OK: openapi.Response('VNFD of an on-boarded VNF package', + schema=openapi.Schema(format=openapi.FORMAT_BINARY, + type=openapi.TYPE_STRING)), status.HTTP_404_NOT_FOUND: "VNF package does not exist", status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error" - } + }, + produces='application/octet-stream', + operation_id='VNFD of an on-boarded VNF package' ) @api_view(http_method_names=["GET"]) @view_safe_call_with_log(logger=logger) @@ -113,7 +118,9 @@ def vnfd_rd(request, **kwargs): tags=[TAG_VNF_PACKAGE_API], request_body=no_body, responses={ - status.HTTP_200_OK: "Return csar file of VNF package", + status.HTTP_200_OK: openapi.Response('VNF package file', + schema=openapi.Schema(format=openapi.FORMAT_BINARY, + type=openapi.TYPE_STRING)), status.HTTP_404_NOT_FOUND: "VNF package does not exist", status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error" } |