Browse code

Add whitespace and create a script to run generation

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Daniel Nephin authored on 2016/10/05 00:28:23
Showing 3 changed files
... ...
@@ -140,8 +140,6 @@ win: build ## cross build the binary for windows
140 140
 
141 141
 .PHONY: swagger-gen
142 142
 swagger-gen:
143
-	docker run --rm -v $(PWD):/work -w /work quay.io/goswagger/swagger \
144
-		generate model -m "types" -f api/swagger.yaml -t api/ --skip-validator \
145
-			-n Volume \
146
-			-n Port \
147
-			-n ImageSummary
143
+	docker run --rm -v $(PWD):/work -w /work \
144
+		--entrypoint hack/generate-swagger-api.sh \
145
+		quay.io/goswagger/swagger
... ...
@@ -84,6 +84,7 @@ definitions:
84 84
       PrivatePort: 8080
85 85
       PublicPort: 80
86 86
       Type: "tcp"
87
+
87 88
   MountPoint:
88 89
     type: "object"
89 90
     description: "A mount point inside a container"
... ...
@@ -104,6 +105,7 @@ definitions:
104 104
         type: "boolean"
105 105
       Propagation:
106 106
         type: "string"
107
+
107 108
   DeviceMapping:
108 109
     type: "object"
109 110
     description: "A device mapping between the host and container"
... ...
@@ -118,6 +120,7 @@ definitions:
118 118
       PathOnHost: "/dev/deviceName"
119 119
       PathInContainer: "/dev/deviceName"
120 120
       CgroupPermissions: "mrw"
121
+
121 122
   ThrottleDevice:
122 123
     type: "object"
123 124
     properties:
... ...
@@ -129,6 +132,7 @@ definitions:
129 129
         type: "integer"
130 130
         format: "int64"
131 131
         minimum: 0
132
+
132 133
   Mount:
133 134
     type: "object"
134 135
     properties:
... ...
@@ -188,6 +192,7 @@ definitions:
188 188
                 type: "object"
189 189
                 additionalProperties:
190 190
                   type: "string"
191
+
191 192
   RestartPolicy:
192 193
     description: |
193 194
       The behavior to apply when the container exits. The default is not to restart.
... ...
@@ -209,6 +214,7 @@ definitions:
209 209
         type: "integer"
210 210
         description: "If `on-failure` is used, the number of times to retry before giving up"
211 211
     default: {}
212
+
212 213
   Resources:
213 214
     description: "A container's resources (cgroups config, ulimits, etc)"
214 215
     type: "object"
... ...
@@ -680,6 +686,7 @@ definitions:
680 680
         type: "array"
681 681
         items:
682 682
           type: "string"
683
+
683 684
   NetworkConfig:
684 685
     description: "TODO: check is correct"
685 686
     type: "object"
... ...
@@ -700,6 +707,7 @@ definitions:
700 700
         type: "array"
701 701
         items:
702 702
           $ref: "#/definitions/Port"
703
+
703 704
   GraphDriver:
704 705
     description: "Information about this container's graph driver."
705 706
     type: "object"
... ...
@@ -710,6 +718,7 @@ definitions:
710 710
         type: "object"
711 711
         additionalProperties:
712 712
           type: "string"
713
+
713 714
   Image:
714 715
     type: "object"
715 716
     properties:
... ...
@@ -829,6 +838,7 @@ definitions:
829 829
       username: "hannibal"
830 830
       password: "xxxx"
831 831
       serveraddress: "https://index.docker.io/v1/"
832
+
832 833
   ProcessConfig:
833 834
     type: "object"
834 835
     properties:
... ...
@@ -844,6 +854,7 @@ definitions:
844 844
         type: "array"
845 845
         items:
846 846
           type: "string"
847
+
847 848
   Volume:
848 849
     type: "object"
849 850
     required: [Name, Driver, Mountpoint, Labels, Scope]
... ...
@@ -911,6 +922,7 @@ definitions:
911 911
         com.example.some-label: "some-value"
912 912
         com.example.some-other-label: "some-other-value"
913 913
       Scope: "local"
914
+
914 915
   Network:
915 916
     type: "object"
916 917
     properties:
... ...
@@ -980,6 +992,7 @@ definitions:
980 980
           type: "object"
981 981
           additionalProperties:
982 982
             type: "string"
983
+
983 984
   NetworkContainer:
984 985
     type: "object"
985 986
     properties:
... ...
@@ -991,6 +1004,7 @@ definitions:
991 991
         type: "string"
992 992
       IPv6Address:
993 993
         type: "string"
994
+
994 995
   BuildInfo:
995 996
     type: "object"
996 997
     properties:
... ...
@@ -1008,6 +1022,7 @@ definitions:
1008 1008
         type: "string"
1009 1009
       progressDetail:
1010 1010
         $ref: "#/definitions/ProgressDetail"
1011
+
1011 1012
   CreateImageInfo:
1012 1013
     type: "object"
1013 1014
     properties:
... ...
@@ -1019,6 +1034,7 @@ definitions:
1019 1019
         type: "string"
1020 1020
       progressDetail:
1021 1021
         $ref: "#/definitions/ProgressDetail"
1022
+
1022 1023
   PushImageInfo:
1023 1024
     type: "object"
1024 1025
     properties:
... ...
@@ -1044,6 +1060,7 @@ definitions:
1044 1044
         type: "integer"
1045 1045
       message:
1046 1046
         type: "integer"
1047
+
1047 1048
   Error:
1048 1049
     description: "Represents an error."
1049 1050
     type: "object"
... ...
@@ -1054,6 +1071,7 @@ definitions:
1054 1054
         type: "string"
1055 1055
     example:
1056 1056
       message: "Something went wrong."
1057
+
1057 1058
   EndpointSettings:
1058 1059
     description: "Configuration for a network endpoint."
1059 1060
     type: "object"
... ...
@@ -1097,6 +1115,7 @@ definitions:
1097 1097
         format: "int64"
1098 1098
       MacAddress:
1099 1099
         type: "string"
1100
+
1100 1101
   PluginMount:
1101 1102
     type: "object"
1102 1103
     properties:
... ...
@@ -1118,6 +1137,7 @@ definitions:
1118 1118
         type: "array"
1119 1119
         items:
1120 1120
           type: "string"
1121
+
1121 1122
   PluginDevice:
1122 1123
     type: "object"
1123 1124
     properties:
... ...
@@ -1131,6 +1151,7 @@ definitions:
1131 1131
           type: "string"
1132 1132
       Path:
1133 1133
         type: "string"
1134
+
1134 1135
   Plugin:
1135 1136
     description: "A plugin for the Remote API"
1136 1137
     type: "object"
... ...
@@ -1317,6 +1338,7 @@ definitions:
1317 1317
           Description: "command line arguments"
1318 1318
           Settable: null
1319 1319
           Value: []
1320
+
1320 1321
   NodeSpec:
1321 1322
     type: "object"
1322 1323
     properties:
... ...
@@ -5299,26 +5321,32 @@ paths:
5299 5299
           type: "string"
5300 5300
       tags:
5301 5301
         - "Exec"
5302
+
5302 5303
   /volumes:
5303 5304
     get:
5304 5305
       summary: "List volumes"
5305
-      operationId: "GetVolumesList"
5306
-      produces:
5307
-        - "application/json"
5306
+      operationId: "VolumesList"
5307
+      produces: ["application/json"]
5308 5308
       responses:
5309 5309
         200:
5310
-          description: "No error"
5310
+          description: "Summary volume data that matches the query"
5311 5311
           schema:
5312 5312
             type: "object"
5313
+            required: [Volumes, Warnings]
5313 5314
             properties:
5314 5315
               Volumes:
5315 5316
                 type: "array"
5317
+                x-nullable: false
5318
+                description: "List of volumes"
5316 5319
                 items:
5317 5320
                   $ref: "#/definitions/Volume"
5318 5321
               Warnings:
5319 5322
                 type: "array"
5323
+                x-nullable: false
5324
+                description: "Warnings that occurred when fetching the list of volumes"
5320 5325
                 items:
5321 5326
                   type: "string"
5327
+
5322 5328
           examples:
5323 5329
             application/json:
5324 5330
               Volumes:
... ...
@@ -5338,14 +5366,21 @@ paths:
5338 5338
         - name: "filters"
5339 5339
           in: "query"
5340 5340
           description: |
5341
-            JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. Available filters:
5341
+            JSON encoded value of the filters (a `map[string][]string`) to
5342
+            process on the volumes list. Available filters:
5342 5343
 
5343 5344
             - `name=<volume-name>` Matches all or part of a volume name.
5344
-            - `dangling=<boolean>` When set to `true` (or `1`), returns all volumes that are not in use by a container. When set to `false` (or `0`), only volumes that are in use by one or more containers are returned.
5345
-            - `driver=<volume-driver-name>` Matches all or part of a volume driver name.
5345
+            - `dangling=<boolean>` When set to `true` (or `1`), returns all
5346
+               volumes that are not in use by a container. When set to `false`
5347
+               (or `0`), only volumes that are in use by one or more
5348
+               containers are returned.
5349
+            - `driver=<volume-driver-name>` Matches all or part of a volume
5350
+              driver name.
5346 5351
           type: "string"
5352
+          format: "json"
5347 5353
       tags:
5348 5354
         - "Volume"
5355
+
5349 5356
   /volumes/create:
5350 5357
     post:
5351 5358
       summary: "Create a volume"
5352 5359
new file mode 100755
... ...
@@ -0,0 +1,8 @@
0
+#!/bin/sh
1
+set -eu
2
+
3
+swagger generate model -f api/swagger.yaml \
4
+    -t api -m types --skip-validator \
5
+    -n Volume \
6
+    -n Port \
7
+    -n ImageSummary