From 5d9e13bc8453c856f055769008dac9311f43c265 Mon Sep 17 00:00:00 2001
From: Bjorn Neergaard <bjorn.neergaard@docker.com>
Date: Mon, 26 Feb 2024 10:25:08 -0700
Subject: [PATCH] api: omit missing Created field from ImageInspect response

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
---
 api/swagger.yaml    | 6 +++++-
 api/types/types.go  | 6 +++++-
 docs/api/v1.44.yaml | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/api/swagger.yaml b/api/swagger.yaml
index e55a76f..350d37a 100644
--- a/api/swagger.yaml
+++ b/api/swagger.yaml
@@ -1743,8 +1743,12 @@ definitions:
         description: |
           Date and time at which the image was created, formatted in
           [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
+
+          This information is only available if present in the image,
+          and omitted otherwise.
         type: "string"
-        x-nullable: false
+        format: "dateTime"
+        x-nullable: true
         example: "2022-02-04T21:20:12.497794809Z"
       Container:
         description: |
diff --git a/api/types/types.go b/api/types/types.go
index 5c56a0c..3c1f69a 100644
--- a/api/types/types.go
+++ b/api/types/types.go
@@ -72,8 +72,12 @@ type ImageInspect struct {
 
 	// Created is the date and time at which the image was created, formatted in
 	// RFC 3339 nano-seconds (time.RFC3339Nano).
-	Created string
 
+	//
+	// This information is only available if present in the image,
+	// and omitted otherwise.
+	Created string `json:",omitempty"`
+ 
 	// Container is the ID of the container that was used to create the image.
 	//
 	// Depending on how the image was created, this field may be empty.
diff --git a/docs/api/v1.44.yaml b/docs/api/v1.44.yaml
index e55a76f..350d37a 100644
--- a/docs/api/v1.44.yaml
+++ b/docs/api/v1.44.yaml
@@ -1743,8 +1743,12 @@ definitions:
         description: |
           Date and time at which the image was created, formatted in
           [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
+
+          This information is only available if present in the image,
+          and omitted otherwise.
         type: "string"
-        x-nullable: false
+        format: "dateTime"
+        x-nullable: true
         example: "2022-02-04T21:20:12.497794809Z"
       Container:
         description: |
-- 
2.41.0

