summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-01-26 17:16:54 +0800
committeryunlong ying <ying.yunlong@zte.com.cn>2018-01-26 09:38:00 +0000
commit03ddcb24a50bb596a399670a5cc3b2319d59e29e (patch)
tree1f8a1c6b8d4371ba4f0076ec00d850f7871c4480 /res
parent09a21ea186aff5cbee6dcc5573f570f49c251812 (diff)
Fix vfc-vnfres auto-swagger bugs.
SwaggerGenerationError at /cached/swagger/ request_body can only be applied to PUT, PATCH or POST views Change-Id: If3024f9ad11449ad23af30bb6f334f0ac617d5ad Issue-ID: VFC-679 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'res')
-rw-r--r--res/res/resources/serializers.py26
-rw-r--r--res/res/resources/views.py22
2 files changed, 11 insertions, 37 deletions
diff --git a/res/res/resources/serializers.py b/res/res/resources/serializers.py
index 774d62c..aaf7598 100644
--- a/res/res/resources/serializers.py
+++ b/res/res/resources/serializers.py
@@ -15,21 +15,6 @@
from rest_framework import serializers
-class NoneSerializer(serializers.Serializer):
- pass
-
-
-# {
-# "resp_data": [{
-# "cpinstanceid": "cp0",
-# "cpdid": "cpd0",
-# "cpinstancename": "cpinstname0",
-# "vlinstanceid": "vlinst0",
-# "ownertype": 0,
-# "ownerid": "01",
-# "relatedtype": 0
-# }]
-# }
class CpsResponseSerializer(serializers.Serializer):
cpinstanceid = serializers.CharField(help_text="the cp instance id", required=True)
cpdid = serializers.CharField(help_text="the cpd id", required=True)
@@ -44,17 +29,6 @@ class CpsInfoSerializer(serializers.Serializer):
resp_data = CpsResponseSerializer(help_text="the response data", many=True)
-# {
-# "resp_data": [{
-# "storageid": "st0",
-# "vimid": "vim0",
-# "resouceid": "res0",
-# "insttype": 0,
-# "instid": "01",
-# "storagetype": "stype0",
-# "size": "0"
-# }]
-# }
class VolumeResponseSerializer(serializers.Serializer):
storageid = serializers.CharField(help_text="the storage id", required=True)
vimid = serializers.CharField(help_text="the vim id", required=True)
diff --git a/res/res/resources/views.py b/res/res/resources/views.py
index 70c38b3..dfecd87 100644
--- a/res/res/resources/views.py
+++ b/res/res/resources/views.py
@@ -26,7 +26,7 @@ from res.pub.database.models import NfInstModel, StorageInstModel, NetworkInstMo
from res.pub.exceptions import VNFRESException
from res.pub.utils.syscomm import fun_name
from res.pub.utils.values import ignore_case_get
-from res.resources.serializers import VolumeInfoSerializer, NoneSerializer, CpsInfoSerializer
+from res.resources.serializers import VolumeInfoSerializer, CpsInfoSerializer
logger = logging.getLogger(__name__)
@@ -309,11 +309,11 @@ def fill_subnets_data(subnet):
class getCps(APIView):
- @swagger_auto_schema(request_body=NoneSerializer(),
- responses={
- status.HTTP_200_OK: CpsInfoSerializer(),
- status.HTTP_404_NOT_FOUND: 'Cps does not exist',
- status.HTTP_500_INTERNAL_SERVER_ERROR: 'internal error'})
+ @swagger_auto_schema(
+ responses={
+ status.HTTP_200_OK: CpsInfoSerializer(),
+ status.HTTP_404_NOT_FOUND: 'Cps does not exist',
+ status.HTTP_500_INTERNAL_SERVER_ERROR: 'internal error'})
def get(self, request, vnfInstanceId):
logger.debug("Query all the cps by vnfInstanceId[%s]", fun_name())
try:
@@ -349,11 +349,11 @@ def fill_cps_data(cp):
class getVolumes(APIView):
- @swagger_auto_schema(request_body=NoneSerializer(),
- responses={
- status.HTTP_200_OK: VolumeInfoSerializer(),
- status.HTTP_404_NOT_FOUND: 'Volumes does not exist',
- status.HTTP_500_INTERNAL_SERVER_ERROR: 'internal error'})
+ @swagger_auto_schema(
+ responses={
+ status.HTTP_200_OK: VolumeInfoSerializer(),
+ status.HTTP_404_NOT_FOUND: 'Volumes does not exist',
+ status.HTTP_500_INTERNAL_SERVER_ERROR: 'internal error'})
def get(self, request, vnfInstanceId):
logger.debug("Query all the volumes by vnfInstanceId[%s]", fun_name())
try: