Browse Source

add partition swagger

Signed-off-by: Gitea <zizhao.chen@zilliz.com>
Gitea 3 years ago
parent
commit
f876ebc7be
2 changed files with 100 additions and 7 deletions
  1. 3 7
      express/src/partitions/partitions.controller.ts
  2. 97 0
      express/src/partitions/swagger.yml

+ 3 - 7
express/src/partitions/partitions.controller.ts

@@ -19,11 +19,7 @@ export class PartitionController {
   }
 
   generateRoutes() {
-    this.router.get(
-      "/",
-      dtoValidationMiddleware(GetPartitionsInfoDto),
-      this.getPatitionsInfo.bind(this)
-    );
+    this.router.get("/", this.getPatitionsInfo.bind(this));
 
     this.router.post(
       "/",
@@ -31,13 +27,13 @@ export class PartitionController {
       this.managePartition.bind(this)
     );
 
-    this.router.post(
+    this.router.put(
       "/load",
       dtoValidationMiddleware(LoadPartitionsDto),
       this.loadPartition.bind(this)
     );
 
-    this.router.post(
+    this.router.put(
       "/release",
       dtoValidationMiddleware(LoadPartitionsDto),
       this.releasePartition.bind(this)

+ 97 - 0
express/src/partitions/swagger.yml

@@ -0,0 +1,97 @@
+paths:
+  /partitions:
+    get:
+      tags: 
+        - Partition
+      description: Get all partitions information
+      parameters:
+        - in: query
+          name: collection_name
+          type: string
+          description: Collection name
+      responses:
+        200:
+          schema:
+            type: object
+  
+    post:
+      tags: 
+        - Partition
+      description: Create or delete partition excepte _default
+      requestBody:
+        description: Manage partition req body
+        required: true
+        content:
+          application/json:
+            schema:
+              type: object
+              required:
+                - type
+                - collection_name
+                - partition_name
+              properties:
+                type:
+                  type: string
+                  example: create
+                collection_name:
+                  type: string
+                  example: ''
+                partition_name:
+                  type: string
+                  example: ''
+      responses:
+        200:
+          schema:
+            type: object
+
+  /partitions/load:
+    put:
+      tags: 
+        - Partition
+      description: Load partition to cache
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              type: object
+              required:
+                - collection_name
+                - partition_name
+              properties:
+                collection_name:
+                  type: string
+                  example: ''
+                partition_names:
+                  type: array
+                  example: []
+      responses:
+        200:
+          schema:
+            type: object
+  /partitions/release:
+    put:
+      tags: 
+        - Partition
+      description: Release partition from cache
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              type: object
+              required:
+                - collection_name
+                - partition_name
+              properties:
+                collection_name:
+                  type: string
+                  example: ''
+                partition_names:
+                  type: array
+                  example: []
+      responses:
+        200:
+          schema:
+            type: object
+