Browse Source

cleanup swagger API with multiple examples

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Nicolas De Loof 3 years ago
parent
commit
3671cb90a3
1 changed files with 11 additions and 23 deletions
  1. 11 23
      api/swagger.yaml

+ 11 - 23
api/swagger.yaml

@@ -3783,6 +3783,7 @@ definitions:
 
 
   ServiceSpec:
   ServiceSpec:
     description: "User modifiable configuration for a service."
     description: "User modifiable configuration for a service."
+    type: object
     properties:
     properties:
       Name:
       Name:
         description: "Name of the service."
         description: "Name of the service."
@@ -5325,6 +5326,7 @@ definitions:
 
 
   PeerNode:
   PeerNode:
     description: "Represents a peer-node in the swarm"
     description: "Represents a peer-node in the swarm"
+    type: "object"
     properties:
     properties:
       NodeID:
       NodeID:
         description: "Unique identifier of for this node in the swarm."
         description: "Unique identifier of for this node in the swarm."
@@ -7275,17 +7277,7 @@ paths:
         400:
         400:
           description: "Bad parameter"
           description: "Bad parameter"
           schema:
           schema:
-            allOf:
-              - $ref: "#/definitions/ErrorResponse"
-              - type: "object"
-                properties:
-                  message:
-                    description: |
-                      The error message. Either "must specify path parameter"
-                      (path cannot be empty) or "not a directory" (path was
-                      asserted to be a directory but exists as a file).
-                    type: "string"
-                    x-nullable: false
+            $ref: "#/definitions/ErrorResponse"
         404:
         404:
           description: "Container or path does not exist"
           description: "Container or path does not exist"
           schema:
           schema:
@@ -7320,17 +7312,7 @@ paths:
         400:
         400:
           description: "Bad parameter"
           description: "Bad parameter"
           schema:
           schema:
-            allOf:
-              - $ref: "#/definitions/ErrorResponse"
-              - type: "object"
-                properties:
-                  message:
-                    description: |
-                      The error message. Either "must specify path parameter"
-                      (path cannot be empty) or "not a directory" (path was
-                      asserted to be a directory but exists as a file).
-                    type: "string"
-                    x-nullable: false
+            $ref: "#/definitions/ErrorResponse"
         404:
         404:
           description: "Container or path does not exist"
           description: "Container or path does not exist"
           schema:
           schema:
@@ -7356,7 +7338,10 @@ paths:
       tags: ["Container"]
       tags: ["Container"]
     put:
     put:
       summary: "Extract an archive of files or folders to a directory in a container"
       summary: "Extract an archive of files or folders to a directory in a container"
-      description: "Upload a tar archive to be extracted to a path in the filesystem of container id."
+      description: |
+        Upload a tar archive to be extracted to a path in the filesystem of container id.
+        `path` parameter is asserted to be a directory. If it exists as a file, 400 error
+        will be returned with message "not a directory".
       operationId: "PutContainerArchive"
       operationId: "PutContainerArchive"
       consumes: ["application/x-tar", "application/octet-stream"]
       consumes: ["application/x-tar", "application/octet-stream"]
       responses:
       responses:
@@ -7366,6 +7351,9 @@ paths:
           description: "Bad parameter"
           description: "Bad parameter"
           schema:
           schema:
             $ref: "#/definitions/ErrorResponse"
             $ref: "#/definitions/ErrorResponse"
+          examples:
+            application/json:
+              message: "not a directory"
         403:
         403:
           description: "Permission denied, the volume or container rootfs is marked as read-only."
           description: "Permission denied, the volume or container rootfs is marked as read-only."
           schema:
           schema: