Repository: moby/moby (language: go)

Issue:
Swagger spec for HealthConfig type's time.Duration fields does not annotate them as 64-bit ints
**Description**

The swagger spec defines [`HealthConfig`'s `Interval`, `Timeout` and `StartPeriod` fields](https://github.com/moby/moby/blob/2bfa24b39393f3e6e1ec38e1d76004e5a50d109f/api/swagger.yaml#L597) to have `type: "integer"`, which means a Swagger generator defaults to emitting them as 32-bit integer fields. However [the corresponding golang type](https://github.com/moby/moby/blob/2bfa24b39393f3e6e1ec38e1d76004e5a50d109f/api/types/container/config.go#L17) for these fields is `time.Duration`, so these fields should be annotated with `format: "int64"` (like [this other nanoseconds field](https://github.com/moby/moby/blob/2bfa24b39393f3e6e1ec38e1d76004e5a50d109f/api/swagger.yaml#L3207)).

**Describe the results you received:**


**Describe the results you expected:**


**Additional information you deem important (e.g. issue happens only occasionally):**

**Output of `docker version`:**

```
```

**Output of `docker info`:**

```
```

**Additional environment details (AWS, VirtualBox, physical, etc.):**



Discussion / hints:
The same bug exists for [HostConfig.ShmSize](https://github.com/docker/docker-ce/blob/19.03/components/engine/api/swagger.yaml#L805-L808) where [the golang type is `int64`](https://github.com/moby/moby/blob/88d093cbb4252b588c80a36bbb7eb5f46a87d87f/api/types/container/host_config.go#L426)

Fix patch:
diff --git a/api/swagger.yaml b/api/swagger.yaml
index 34fe3d4e191c9..e39930490992f 100644
--- a/api/swagger.yaml
+++ b/api/swagger.yaml
@@ -771,11 +771,13 @@ definitions:
           The time to wait between checks in nanoseconds. It should be 0 or at
           least 1000000 (1 ms). 0 means inherit.
         type: "integer"
+        format: "int64"
       Timeout:
         description: |
           The time to wait before considering the check to have hung. It should
           be 0 or at least 1000000 (1 ms). 0 means inherit.
         type: "integer"
+        format: "int64"
       Retries:
         description: |
           The number of consecutive failures needed to consider a container as
@@ -787,6 +789,7 @@ definitions:
           health-retries countdown in nanoseconds. It should be 0 or at least
           1000000 (1 ms). 0 means inherit.
         type: "integer"
+        format: "int64"
 
   Health:
     description: |
@@ -1625,7 +1628,7 @@ definitions:
           List of image names/tags in the local image cache that reference this
           image.
 
-          Multiple image tags can refer to the same imagem and this list may be
+          Multiple image tags can refer to the same image, and this list may be
           empty if no tags reference the image, in which case the image is
           "untagged", in which case it can still be referenced by its ID.
         type: "array"
@@ -1826,7 +1829,7 @@ definitions:
           List of image names/tags in the local image cache that reference this
           image.
 
-          Multiple image tags can refer to the same imagem and this list may be
+          Multiple image tags can refer to the same image, and this list may be
           empty if no tags reference the image, in which case the image is
           "untagged", in which case it can still be referenced by its ID.
         type: "array"
@@ -1876,6 +1879,7 @@ definitions:
           This size is not calculated by default. `-1` indicates that the value
           has not been set / calculated.
         type: "integer"
+        format: "int64"
         x-nullable: false
         example: 1239828
       VirtualSize:
@@ -2023,6 +2027,7 @@ definitions:
         properties:
           Size:
             type: "integer"
+            format: "int64"
             default: -1
             description: |
               Amount of disk space used by the volume (in bytes). This information
@@ -2032,6 +2037,7 @@ definitions:
             x-nullable: false
           RefCount:
             type: "integer"
+            format: "int64"
             default: -1
             description: |
               The number of containers referencing this volume. This field
@@ -4655,6 +4661,7 @@ definitions:
       StatusCode:
         description: "Exit code of the container"
         type: "integer"
+        format: "int64"
         x-nullable: false
       Error:
         $ref: "#/definitions/ContainerWaitExitError"
diff --git a/api/types/image_summary.go b/api/types/image_summary.go
index 53c2885758584..90b983a25cc5d 100644
--- a/api/types/image_summary.go
+++ b/api/types/image_summary.go
@@ -61,7 +61,7 @@ type ImageSummary struct {
 	// List of image names/tags in the local image cache that reference this
 	// image.
 	//
-	// Multiple image tags can refer to the same imagem and this list may be
+	// Multiple image tags can refer to the same image, and this list may be
 	// empty if no tags reference the image, in which case the image is
 	// "untagged", in which case it can still be referenced by its ID.
 	//
diff --git a/api/types/types.go b/api/types/types.go
index 60d15d2bc599b..d36850728295a 100644
--- a/api/types/types.go
+++ b/api/types/types.go
@@ -48,7 +48,7 @@ type ImageInspect struct {
 	// RepoTags is a list of image names/tags in the local image cache that
 	// reference this image.
 	//
-	// Multiple image tags can refer to the same imagem and this list may be
+	// Multiple image tags can refer to the same image, and this list may be
 	// empty if no tags reference the image, in which case the image is
 	// "untagged", in which case it can still be referenced by its ID.
 	RepoTags []string
diff --git a/docs/api/v1.41.yaml b/docs/api/v1.41.yaml
index 6b6347606835c..2a65508eea6f3 100644
--- a/docs/api/v1.41.yaml
+++ b/docs/api/v1.41.yaml
@@ -773,11 +773,13 @@ definitions:
           The time to wait between checks in nanoseconds. It should be 0 or at
           least 1000000 (1 ms). 0 means inherit.
         type: "integer"
+        format: "int64"
       Timeout:
         description: |
           The time to wait before considering the check to have hung. It should
           be 0 or at least 1000000 (1 ms). 0 means inherit.
         type: "integer"
+        format: "int64"
       Retries:
         description: |
           The number of consecutive failures needed to consider a container as
@@ -789,6 +791,7 @@ definitions:
           health-retries countdown in nanoseconds. It should be 0 or at least
           1000000 (1 ms). 0 means inherit.
         type: "integer"
+        format: "int64"
 
   Health:
     description: |
@@ -1107,6 +1110,7 @@ definitions:
               remapping option is enabled.
           ShmSize:
             type: "integer"
+            format: "int64"
             description: |
               Size of `/dev/shm` in bytes. If omitted, the system uses 64MB.
             minimum: 0
@@ -1627,7 +1631,7 @@ definitions:
           List of image names/tags in the local image cache that reference this
           image.
 
-          Multiple image tags can refer to the same imagem and this list may be
+          Multiple image tags can refer to the same image, and this list may be
           empty if no tags reference the image, in which case the image is
           "untagged", in which case it can still be referenced by its ID.
         type: "array"
@@ -1828,7 +1832,7 @@ definitions:
           List of image names/tags in the local image cache that reference this
           image.
 
-          Multiple image tags can refer to the same imagem and this list may be
+          Multiple image tags can refer to the same image, and this list may be
           empty if no tags reference the image, in which case the image is
           "untagged", in which case it can still be referenced by its ID.
         type: "array"
@@ -1878,6 +1882,7 @@ definitions:
           This size is not calculated by default. `-1` indicates that the value
           has not been set / calculated.
         type: "integer"
+        format: "int64"
         x-nullable: false
         example: 1239828
       VirtualSize:
@@ -2022,6 +2027,7 @@ definitions:
         properties:
           Size:
             type: "integer"
+            format: "int64"
             default: -1
             description: |
               Amount of disk space used by the volume (in bytes). This information
@@ -2031,6 +2037,7 @@ definitions:
             x-nullable: false
           RefCount:
             type: "integer"
+            format: "int64"
             default: -1
             description: |
               The number of containers referencing this volume. This field
@@ -4632,6 +4639,7 @@ definitions:
       StatusCode:
         description: "Exit code of the container"
         type: "integer"
+        format: "int64"
         x-nullable: false
       Error:
         $ref: "#/definitions/ContainerWaitExitError"


Test patch: