diff options
author | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-02-01 09:39:45 +0800 |
---|---|---|
committer | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-02-01 09:39:45 +0800 |
commit | c5e2158866118d0024fc48d2fbc80e23361e9f25 (patch) | |
tree | accf450896d40e73ecde2067da2dfa19bb848a6f | |
parent | 8642c93afc38906bc48c7412a0b9cc381b796bfa (diff) |
Refactor schema names for job swagger
Change-Id: I786d13be423c74e608a5c2d26952071fae164720
Issue-ID: VFC-677
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | catalog/jobs/views.py | 16 | ||||
-rw-r--r-- | catalog/serializers.py | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/catalog/jobs/views.py b/catalog/jobs/views.py index e077fc46..89b5f088 100644 --- a/catalog/jobs/views.py +++ b/catalog/jobs/views.py @@ -22,8 +22,8 @@ from rest_framework import status from catalog.jobs.job_get import GetJobInfoService from catalog.pub.utils.jobutil import JobUtil from catalog.pub.utils.values import ignore_case_get -from catalog.serializers import PostResponseSerializer -from catalog.serializers import GetJobResponseResultSerializer +from catalog.serializers import GetJobResponseSerializer +from catalog.serializers import PostJobResponseResultSerializer from catalog.serializers import PostJobRequestSerializer logger = logging.getLogger(__name__) @@ -46,13 +46,13 @@ class JobView(APIView): operation_description="Get job status", manual_parameters=[input_job_id, input_response_id], responses={ - status.HTTP_200_OK: PostResponseSerializer(), - status.HTTP_500_INTERNAL_SERVER_ERROR: GetJobResponseResultSerializer() + status.HTTP_200_OK: GetJobResponseSerializer(), + status.HTTP_500_INTERNAL_SERVER_ERROR: PostJobResponseResultSerializer() }) def get(self, request, job_id): response_id = ignore_case_get(request.META, 'responseId') ret = GetJobInfoService(job_id, response_id).do_biz() - response_serializer = PostResponseSerializer(data=ret) + response_serializer = GetJobResponseSerializer(data=ret) isValid = response_serializer.is_valid() if not isValid: response = self.handleValidatonError(response_serializer, False) @@ -67,8 +67,8 @@ class JobView(APIView): operation_description="Update job status", manual_parameters=[input_job_id], responses={ - status.HTTP_202_ACCEPTED: GetJobResponseResultSerializer(), - status.HTTP_500_INTERNAL_SERVER_ERROR: GetJobResponseResultSerializer() + status.HTTP_202_ACCEPTED: PostJobResponseResultSerializer(), + status.HTTP_500_INTERNAL_SERVER_ERROR: PostJobResponseResultSerializer() } ) def post(self, request, job_id): @@ -96,7 +96,7 @@ class JobView(APIView): response = Response( data={'result': 'ok'}, status=status.HTTP_202_ACCEPTED) - response_serializer = GetJobResponseResultSerializer( + response_serializer = PostJobResponseResultSerializer( data=response.data) isValid = response_serializer.is_valid() if not isValid: diff --git a/catalog/serializers.py b/catalog/serializers.py index 24362f2d..d44e21cc 100644 --- a/catalog/serializers.py +++ b/catalog/serializers.py @@ -44,7 +44,7 @@ class JobResponseDescriptorSerializer(serializers.Serializer): many=True, help_text="Response History List", required=False) -class PostResponseSerializer(serializers.Serializer): +class GetJobResponseSerializer(serializers.Serializer): jobId = serializers.CharField( help_text="Job Id", required=False) @@ -52,7 +52,7 @@ class PostResponseSerializer(serializers.Serializer): help_text="Job Response Descriptor", required=False) -class GetJobResponseResultSerializer(serializers.Serializer): +class PostJobResponseResultSerializer(serializers.Serializer): result = serializers.CharField(help_text="Result", required=True) msg = serializers.CharField(help_text="Message", required=False) |