瀏覽代碼

Generate GraphDriver from spec, and fix up image spec.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Daniel Nephin 8 年之前
父節點
當前提交
8d5f558de0
共有 4 個文件被更改,包括 54 次插入11 次删除
  1. 36 4
      api/swagger.yaml
  2. 17 0
      api/types/graph_driver_data.go
  3. 0 7
      api/types/types.go
  4. 1 0
      hack/generate-swagger-api.sh

+ 36 - 4
api/swagger.yaml

@@ -829,22 +829,40 @@ definitions:
         items:
           $ref: "#/definitions/Port"
 
-  GraphDriver:
-    description: "Information about this container's graph driver."
+  GraphDriverData:
+    description: "Information about a container's graph driver."
     type: "object"
+    required: [Name, Data]
     properties:
       Name:
         type: "string"
+        x-nullable: false
       Data:
         type: "object"
+        x-nullable: false
         additionalProperties:
           type: "string"
 
   Image:
     type: "object"
+    required:
+      - Id
+      - Parent
+      - Comment
+      - Created
+      - Container
+      - DockerVersion
+      - Author
+      - Architecture
+      - Os
+      - Size
+      - VirtualSize
+      - GraphDrvier
+      - RootFS
     properties:
       Id:
         type: "string"
+        x-nullable: false
       RepoTags:
         type: "array"
         items:
@@ -855,37 +873,51 @@ definitions:
           type: "string"
       Parent:
         type: "string"
+        x-nullable: false
       Comment:
         type: "string"
+        x-nullable: false
       Created:
         type: "string"
+        x-nullable: false
       Container:
         type: "string"
+        x-nullable: false
       ContainerConfig:
         $ref: "#/definitions/Config"
       DockerVersion:
         type: "string"
+        x-nullable: false
       Author:
         type: "string"
+        x-nullable: false
       Config:
         $ref: "#/definitions/Config"
       Architecture:
         type: "string"
+        x-nullable: false
       Os:
         type: "string"
+        x-nullable: false
+      OsVersion:
+        type: "string"
       Size:
         type: "integer"
         format: "int64"
+        x-nullable: false
       VirtualSize:
         type: "integer"
         format: "int64"
+        x-nullable: false
       GraphDriver:
-        $ref: "#/definitions/GraphDriver"
+        $ref: "#/definitions/GraphDriverData"
       RootFS:
         type: "object"
+        required: [Type]
         properties:
           Type:
             type: "string"
+            x-nullable: false
           Layers:
             type: "array"
             items:
@@ -2934,7 +2966,7 @@ paths:
               HostConfig:
                 $ref: "#/definitions/HostConfig"
               GraphDriver:
-                $ref: "#/definitions/GraphDriver"
+                $ref: "#/definitions/GraphDriverData"
               SizeRw:
                 description: "The size of files that have been created or changed by this container."
                 type: "integer"

+ 17 - 0
api/types/graph_driver_data.go

@@ -0,0 +1,17 @@
+package types
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+// GraphDriverData Information about a container's graph driver.
+// swagger:model GraphDriverData
+type GraphDriverData struct {
+
+	// data
+	// Required: true
+	Data map[string]string `json:"Data"`
+
+	// name
+	// Required: true
+	Name string `json:"Name"`
+}

+ 0 - 7
api/types/types.go

@@ -17,13 +17,6 @@ import (
 	"github.com/docker/go-connections/nat"
 )
 
-// GraphDriverData returns Image's graph driver config info
-// when calling inspect command
-type GraphDriverData struct {
-	Name string
-	Data map[string]string
-}
-
 // RootFS returns Image's RootFS description including the layer IDs.
 type RootFS struct {
 	Type      string

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

@@ -4,6 +4,7 @@ set -eu
 swagger generate model -f api/swagger.yaml \
     -t api -m types --skip-validator -C api/swagger-gen.yaml \
     -n ErrorResponse \
+    -n GraphDriverData \
     -n IdResponse \
     -n ImageDeleteResponseItem \
     -n ImageSummary \