Browse Source

Generate GraphDriver from spec, and fix up image spec.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Daniel Nephin 8 years ago
parent
commit
8d5f558de0
4 changed files with 54 additions and 11 deletions
  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:
         items:
           $ref: "#/definitions/Port"
           $ref: "#/definitions/Port"
 
 
-  GraphDriver:
-    description: "Information about this container's graph driver."
+  GraphDriverData:
+    description: "Information about a container's graph driver."
     type: "object"
     type: "object"
+    required: [Name, Data]
     properties:
     properties:
       Name:
       Name:
         type: "string"
         type: "string"
+        x-nullable: false
       Data:
       Data:
         type: "object"
         type: "object"
+        x-nullable: false
         additionalProperties:
         additionalProperties:
           type: "string"
           type: "string"
 
 
   Image:
   Image:
     type: "object"
     type: "object"
+    required:
+      - Id
+      - Parent
+      - Comment
+      - Created
+      - Container
+      - DockerVersion
+      - Author
+      - Architecture
+      - Os
+      - Size
+      - VirtualSize
+      - GraphDrvier
+      - RootFS
     properties:
     properties:
       Id:
       Id:
         type: "string"
         type: "string"
+        x-nullable: false
       RepoTags:
       RepoTags:
         type: "array"
         type: "array"
         items:
         items:
@@ -855,37 +873,51 @@ definitions:
           type: "string"
           type: "string"
       Parent:
       Parent:
         type: "string"
         type: "string"
+        x-nullable: false
       Comment:
       Comment:
         type: "string"
         type: "string"
+        x-nullable: false
       Created:
       Created:
         type: "string"
         type: "string"
+        x-nullable: false
       Container:
       Container:
         type: "string"
         type: "string"
+        x-nullable: false
       ContainerConfig:
       ContainerConfig:
         $ref: "#/definitions/Config"
         $ref: "#/definitions/Config"
       DockerVersion:
       DockerVersion:
         type: "string"
         type: "string"
+        x-nullable: false
       Author:
       Author:
         type: "string"
         type: "string"
+        x-nullable: false
       Config:
       Config:
         $ref: "#/definitions/Config"
         $ref: "#/definitions/Config"
       Architecture:
       Architecture:
         type: "string"
         type: "string"
+        x-nullable: false
       Os:
       Os:
         type: "string"
         type: "string"
+        x-nullable: false
+      OsVersion:
+        type: "string"
       Size:
       Size:
         type: "integer"
         type: "integer"
         format: "int64"
         format: "int64"
+        x-nullable: false
       VirtualSize:
       VirtualSize:
         type: "integer"
         type: "integer"
         format: "int64"
         format: "int64"
+        x-nullable: false
       GraphDriver:
       GraphDriver:
-        $ref: "#/definitions/GraphDriver"
+        $ref: "#/definitions/GraphDriverData"
       RootFS:
       RootFS:
         type: "object"
         type: "object"
+        required: [Type]
         properties:
         properties:
           Type:
           Type:
             type: "string"
             type: "string"
+            x-nullable: false
           Layers:
           Layers:
             type: "array"
             type: "array"
             items:
             items:
@@ -2934,7 +2966,7 @@ paths:
               HostConfig:
               HostConfig:
                 $ref: "#/definitions/HostConfig"
                 $ref: "#/definitions/HostConfig"
               GraphDriver:
               GraphDriver:
-                $ref: "#/definitions/GraphDriver"
+                $ref: "#/definitions/GraphDriverData"
               SizeRw:
               SizeRw:
                 description: "The size of files that have been created or changed by this container."
                 description: "The size of files that have been created or changed by this container."
                 type: "integer"
                 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"
 	"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.
 // RootFS returns Image's RootFS description including the layer IDs.
 type RootFS struct {
 type RootFS struct {
 	Type      string
 	Type      string

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

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