diff options
author | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-01-30 15:20:23 +0800 |
---|---|---|
committer | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-01-30 15:20:23 +0800 |
commit | 8642c93afc38906bc48c7412a0b9cc381b796bfa (patch) | |
tree | ab9016415f1426d1ec49366ca274f591dabd98e1 | |
parent | eeee0799bcc6712d12afabde4325f0476fa156ac (diff) |
Add swagger validation code for ns package
Change-Id: Ia18a1efe546ab20ba01d14ddf012d2ae4a357d32
Issue-ID: VFC-685
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | catalog/packages/views.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/catalog/packages/views.py b/catalog/packages/views.py index 39a104c0..2841c10f 100644 --- a/catalog/packages/views.py +++ b/catalog/packages/views.py @@ -194,10 +194,15 @@ def ns_rd_csar(request, *args, **kwargs): csar_id = ignore_case_get(kwargs, "csarId") logger.info("Enter %s, method is %s, csar_id is %s", fun_name(), request.method, csar_id) - ret, normal_status = None, None + ret, normal_status, response_serializer, validation_error = None, None, None, None if request.method == 'GET': ret = ns_package.ns_get_csar(csar_id) normal_status = status.HTTP_200_OK + if ret[0] == 0: + response_serializer = NsPackageSerializer(data=ret[1]) + validation_error = handleValidatonError(response_serializer, False) + if validation_error: + return validation_error elif request.method == 'DELETE': ret = ns_package.ns_delete_csar(csar_id) normal_status = status.HTTP_202_ACCEPTED |