Add vfc-vnfres samples auto-swagger 97/30097/2
authorying.yunlong <ying.yunlong@zte.com.cn>
Fri, 2 Feb 2018 02:39:09 +0000 (10:39 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Fri, 2 Feb 2018 02:53:45 +0000 (10:53 +0800)
Change-Id: I34083b08021bc36287449695caa2a80ca127b7dc
Issue-ID: VFC-679
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
res/res/resources/urls.py
res/res/samples/views.py

index d7f8297..d04ca53 100644 (file)
@@ -13,7 +13,6 @@
 # limitations under the License.
 
 from django.conf.urls import url
-from rest_framework.urlpatterns import format_suffix_patterns
 
 from res.resources import views
 
@@ -27,5 +26,3 @@ urlpatterns = [
     url(r'^api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/cps$', views.getCps.as_view(), name='get_cps'),
     url(r'^api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/volumes$', views.getVolumes.as_view(), name='get_volumes'),
 ]
-
-urlpatterns = format_suffix_patterns(urlpatterns)
index 5162f23..64ec60f 100644 (file)
@@ -14,6 +14,8 @@
 
 import logging
 
+from drf_yasg.utils import swagger_auto_schema
+from rest_framework import status
 from rest_framework.views import APIView
 from rest_framework.response import Response
 
@@ -21,6 +23,9 @@ logger = logging.getLogger(__name__)
 
 
 class SampleList(APIView):
-    def get(self, request, format=None):
+    @swagger_auto_schema(
+        responses={
+            status.HTTP_200_OK: 'Successfully'})
+    def get(self, request):
         logger.debug("get")
         return Response({"status": "active"})