diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2018-02-02 10:39:09 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2018-02-02 10:53:45 +0800 |
commit | dbc8c50d764ebc6490cd4f94fd548c62eeba0dcb (patch) | |
tree | dc7172677ec1d9018aec74c0f5ea449febfd8268 | |
parent | a8b0f57e73eae183ee4e0a522bb9ead3ca1aaf58 (diff) |
Add vfc-vnfres samples auto-swagger
Change-Id: I34083b08021bc36287449695caa2a80ca127b7dc
Issue-ID: VFC-679
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | res/res/resources/urls.py | 3 | ||||
-rw-r--r-- | res/res/samples/views.py | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/res/res/resources/urls.py b/res/res/resources/urls.py index d7f8297..d04ca53 100644 --- a/res/res/resources/urls.py +++ b/res/res/resources/urls.py @@ -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) diff --git a/res/res/samples/views.py b/res/res/samples/views.py index 5162f23..64ec60f 100644 --- a/res/res/samples/views.py +++ b/res/res/samples/views.py @@ -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"}) |