瀏覽代碼

api: swagger: move ContainerCreateResponse to definitions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父節點
當前提交
ff197417fa

+ 21 - 19
api/swagger.yaml

@@ -4617,6 +4617,26 @@ definitions:
       Health:
         $ref: "#/definitions/Health"
 
+  ContainerCreateResponse:
+    description: "OK response to ContainerCreate operation"
+    type: "object"
+    title: "ContainerCreateResponse"
+    x-go-name: "ContainerCreateCreatedBody"
+    required: [Id, Warnings]
+    properties:
+      Id:
+        description: "The ID of the created container"
+        type: "string"
+        x-nullable: false
+        example: "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743"
+      Warnings:
+        description: "Warnings encountered when creating the container"
+        type: "array"
+        x-nullable: false
+        items:
+          type: "string"
+        example: []
+
   ContainerWaitResponse:
     description: "OK response to ContainerWait operation"
     type: "object"
@@ -6081,25 +6101,7 @@ paths:
         201:
           description: "Container created successfully"
           schema:
-            type: "object"
-            title: "ContainerCreateResponse"
-            description: "OK response to ContainerCreate operation"
-            required: [Id, Warnings]
-            properties:
-              Id:
-                description: "The ID of the created container"
-                type: "string"
-                x-nullable: false
-              Warnings:
-                description: "Warnings encountered when creating the container"
-                type: "array"
-                x-nullable: false
-                items:
-                  type: "string"
-          examples:
-            application/json:
-              Id: "e90e34656806"
-              Warnings: []
+            $ref: "#/definitions/ContainerCreateResponse"
         400:
           description: "bad parameter"
           schema:

+ 0 - 20
api/types/container/container_create.go

@@ -1,20 +0,0 @@
-package container // import "github.com/docker/docker/api/types/container"
-
-// ----------------------------------------------------------------------------
-// Code generated by `swagger generate operation`. DO NOT EDIT.
-//
-// See hack/generate-swagger-api.sh
-// ----------------------------------------------------------------------------
-
-// ContainerCreateCreatedBody OK response to ContainerCreate operation
-// swagger:model ContainerCreateCreatedBody
-type ContainerCreateCreatedBody struct {
-
-	// The ID of the created container
-	// Required: true
-	ID string `json:"Id"`
-
-	// Warnings encountered when creating the container
-	// Required: true
-	Warnings []string `json:"Warnings"`
-}

+ 19 - 0
api/types/container/container_create_created_body.go

@@ -0,0 +1,19 @@
+package container
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+// ContainerCreateCreatedBody ContainerCreateResponse
+//
+// OK response to ContainerCreate operation
+// swagger:model ContainerCreateCreatedBody
+type ContainerCreateCreatedBody struct {
+
+	// The ID of the created container
+	// Required: true
+	ID string `json:"Id"`
+
+	// Warnings encountered when creating the container
+	// Required: true
+	Warnings []string `json:"Warnings"`
+}

+ 1 - 1
hack/generate-swagger-api.sh

@@ -18,6 +18,7 @@ swagger generate model -f api/swagger.yaml \
 
 swagger generate model -f api/swagger.yaml \
 	-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
+	-n ContainerCreateResponse \
 	-n ContainerWaitResponse \
 	-n ContainerWaitExitError
 
@@ -32,7 +33,6 @@ swagger generate operation -f api/swagger.yaml \
 	-T api/templates --skip-responses --skip-parameters --skip-validator \
 	-n Authenticate \
 	-n ContainerChanges \
-	-n ContainerCreate \
 	-n ContainerTop \
 	-n ContainerUpdate \
 	-n ImageHistory