From 6064cbde7436bfcba7407b307d390fcdfd045339 Mon Sep 17 00:00:00 2001 From: maopengzhang Date: Sat, 26 Aug 2017 15:38:58 +0800 Subject: [PATCH] Fix VFC swagger bug Add get job status swagger defintion; Change-Id: Iaa3405f5082c4727586f03836787c526cc9ddc3c Issue-ID: VFC-144 Signed-off-by: maopengzhang --- lcm/swagger/vfc.nslcm.swagger.json | 91 +++++++++++++++++++++++++++---------- lcm/swagger/vfc.others.swagger.json | 50 ++++++++++++++++++-- lcm/swagger/views.py | 2 + 3 files changed, 116 insertions(+), 27 deletions(-) diff --git a/lcm/swagger/vfc.nslcm.swagger.json b/lcm/swagger/vfc.nslcm.swagger.json index 75cc6bab..528ec672 100644 --- a/lcm/swagger/vfc.nslcm.swagger.json +++ b/lcm/swagger/vfc.nslcm.swagger.json @@ -249,34 +249,35 @@ } }, "/jobs/{jobId}": { - "post": { + "get": { "tags": [ "job" ], "summary": "jobstatus", "description": "", - "operationId": "jobstatus", + "operationId": "get_jobstatus", "parameters": [ { "required": true, "type": "string", - "description": "", + "description": "job Id", "name": "jobId", "in": "path" }, { - "in": "body", - "name": "body", - "description": "request param", "required": true, - "schema": { - "$ref": "#/definitions/JobProgressRequest" - } + "type": "string", + "description": "job response message id", + "name": "responseId", + "in": "query" } ], "responses": { "202": { - "description": "" + "description": "", + "schema": { + "$ref": "#/definitions/JobDetailInfo" + } } } } @@ -410,20 +411,7 @@ } } }, - "JobProgressRequest": { - "type": "object", - "properties": { - "progress": { - "type": "string" - }, - "desc": { - "type": "string" - }, - "errcode": { - "type": "string" - } - } - }, + "NsInfo": { "type": "object", "properties": { @@ -532,6 +520,61 @@ "type": "string" } } + }, + "jobResponseInfo": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "progress":{ + "type": "string" + }, + "statusDescription": { + "type": "string" + }, + "errorCode": { + "type": "string" + }, + "responseId": { + "type": "string" + } + } + }, + "JobDetailInfo":{ + "type": "object", + "properties": { + "jobId": { + "type": "string" + }, + "responseDescriptor": + { + "type":"object", + "properties": { + "status": { + "type": "string" + }, + "progress":{ + "type": "string" + }, + "statusDescription": { + "type": "string" + }, + "errorCode": { + "type": "string" + }, + "responseId": { + "type": "string" + }, + "responseHistoryList": { + "type": "array", + "items": { + "$ref": "#/definitions/jobResponseInfo" + } + } + } + } + } } } } \ No newline at end of file diff --git a/lcm/swagger/vfc.others.swagger.json b/lcm/swagger/vfc.others.swagger.json index 9be74901..f6b48fbb 100644 --- a/lcm/swagger/vfc.others.swagger.json +++ b/lcm/swagger/vfc.others.swagger.json @@ -108,7 +108,40 @@ } } } + }, + "/jobs/{jobId}": { + "post": { + "tags": [ + "job" + ], + "summary": "jobstatus", + "description": "", + "operationId": "post_jobprogress", + "parameters": [ + { + "required": true, + "type": "string", + "description": "", + "name": "jobId", + "in": "path" + }, + { + "in": "body", + "name": "body", + "description": "request param", + "required": true, + "schema": { + "$ref": "#/definitions/JobProgressRequest" + } + } + ], + "responses": { + "202": { + "description": "" + } + } } + } }, "definitions": { @@ -120,9 +153,20 @@ } } }, - - - + "JobProgressRequest": { + "type": "object", + "properties": { + "progress": { + "type": "string" + }, + "desc": { + "type": "string" + }, + "errcode": { + "type": "string" + } + } + }, "TableInfo": { "type": "object", "properties": { diff --git a/lcm/swagger/views.py b/lcm/swagger/views.py index 8386bf05..fdef8aed 100644 --- a/lcm/swagger/views.py +++ b/lcm/swagger/views.py @@ -64,7 +64,9 @@ class SwaggerJsonView(APIView): json_data_temp = json.JSONDecoder().decode(f.read()) f.close() + json_data_jobtemp=json_data["paths"]["/jobs/{jobId}"] json_data["paths"].update(json_data_temp["paths"]) + json_data["paths"]["/jobs/{jobId}"].update(json_data_jobtemp) json_data["definitions"].update(json_data_temp["definitions"]) return Response(json_data) -- 2.16.6