Modify the database in the swagger 95/16295/1
authormaopengzhang <zhang.maopeng1@zte.com.cn>
Thu, 28 Sep 2017 08:59:05 +0000 (16:59 +0800)
committermaopengzhang <zhang.maopeng1@zte.com.cn>
Thu, 28 Sep 2017 08:59:05 +0000 (16:59 +0800)
Add database swagger

Change-Id: I182dd1d5c7144790e6fbad7544854657caea5910
Issue-ID: VFC-163
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
lcm/swagger/vfc.db.swagger.json
lcm/swagger/vfc.others.swagger.json
lcm/swagger/views.py

index 6c8efb0..fde55d3 100644 (file)
@@ -1 +1,90 @@
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
\ No newline at end of file
+{\r
+    "swagger": "2.0",\r
+    "info": {\r
+        "version": "1.0.0",\r
+        "title": "ONAP VFC Service Internal DB Rest API"\r
+    },\r
+    "basePath": "/api/nslcm/v1",\r
+    "paths": {\r
+        "/mandb/{modelName}": {\r
+            "get": {\r
+                "tags": [\r
+                    "Database"\r
+                ],\r
+                "summary": "query ns table info",\r
+                "description": "query ns table info",\r
+                "operationId": "query_ns_table",\r
+                "consumes": [\r
+                    "application/json"\r
+                ],\r
+                "produces": [\r
+                    "application/json"\r
+                ],\r
+                "parameters": [\r
+                    {\r
+                        "required": true,\r
+                        "type": "string",\r
+                        "description": "model Name.",\r
+                        "name": "modelName",\r
+                        "in": "path"\r
+                    }\r
+                ],\r
+                "responses": {\r
+                    "200": {\r
+                        "description": "successful operation",\r
+                        "schema": {\r
+                            "$ref": "#/definitions/TableInfo"\r
+                        }\r
+                    },\r
+                    "404": {\r
+                        "description": "URL not found"\r
+                    },\r
+                    "500": {\r
+                        "description": "the url is invalid"\r
+                    }\r
+                }\r
+            },\r
+            "delete": {\r
+                "tags": [\r
+                    "Database"\r
+                ],\r
+                "summary": "ns table delete",\r
+                "description": "ns table delete",\r
+                "operationId": "ns_table_delete",\r
+                "consumes": [\r
+                    "application/json"\r
+                ],\r
+                "produces": [\r
+                    "application/json"\r
+                ],\r
+                "parameters": [\r
+                    {\r
+                        "required": true,\r
+                        "type": "string",\r
+                        "description": "model Name.",\r
+                        "name": "modelName",\r
+                        "in": "path"\r
+                    }\r
+                ],\r
+                "responses": {\r
+                    "204": {\r
+                        "description": "The tables were deleted successfully."\r
+                    },\r
+                    "404": {\r
+                        "description": "URL not found"\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    },\r
+    "definitions": {\r
+        "TableInfo": {\r
+            "type": "object",\r
+            "properties": {\r
+                "count": {\r
+                    "type": "string"\r
+                }\r
+            }\r
+        }\r
+    }\r
+}
\ No newline at end of file
index fe0bc82..16d70c0 100644 (file)
                 }
             }
         },
-        "/mandb/{modelName}": {
-            "get": {
-                "tags": [
-                    "db"
-                ],
-                "summary": "query ns table info",
-                "description": "query ns table info",
-                "operationId": "query_ns_table",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "parameters": [
-                    {
-                        "required": true,
-                        "type": "string",
-                        "description": "model Name.",
-                        "name": "modelName",
-                        "in": "path"
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "successful operation",
-                        "schema": {
-                            "$ref": "#/definitions/TableInfo"
-                        }
-                    },
-                    "404": {
-                        "description": "URL not found"
-                    },
-                    "500": {
-                        "description": "the url is invalid"
-                    }
-                }
-            },
-            "delete": {
-                "tags": [
-                    "db"
-                ],
-                "summary": "ns table delete",
-                "description": "ns table delete",
-                "operationId": "ns_table_delete",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "parameters": [
-                    {
-                        "required": true,
-                        "type": "string",
-                        "description": "model Name.",
-                        "name": "modelName",
-                        "in": "path"
-                    }
-                ],
-                "responses": {
-                    "204": {
-                        "description": "The tables were deleted successfully."
-                    },
-                    "404": {
-                        "description": "URL not found"
-                    }
-                }
-            }
-        },
         "/jobs/{jobId}": {
           "post": {
             "tags": [
               "type": "string"
             }
           }
-        },
-        "TableInfo": {
-            "type": "object",
-            "properties": {
-                "count": {
-                    "type": "string"
-                }
-            }
         }
     }
 }
\ No newline at end of file
index 5034905..e78ecea 100644 (file)
@@ -53,6 +53,14 @@ class SwaggerJsonView(APIView):
         json_data["paths"].update(json_data_temp["paths"])
         json_data["definitions"].update(json_data_temp["definitions"])
 
+        json_file = os.path.join(os.path.dirname(__file__), 'vfc.db.swagger.json')
+        f = open(json_file)
+        json_data_temp = json.JSONDecoder().decode(f.read())
+        f.close()
+
+        json_data["paths"].update(json_data_temp["paths"])
+        json_data["definitions"].update(json_data_temp["definitions"])
+
         json_file = os.path.join(os.path.dirname(__file__), 'vfc.others.swagger.json')
         f = open(json_file)
         json_data_temp = json.JSONDecoder().decode(f.read())