Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
In the specifications, platform is marked as OPTIONAL, and the JSON s…
Browse files Browse the repository at this point in the history
…erialization is well tagged as

omitempty. However a struct by copy is never empty, so the serialization always prints an empty map:
"images": {
	"api": {
		"imageType": "docker",
		"image": "python:3.6",
		"platform": {},
		"description": "python:3.6"
	},
...

To fix it I added a pointer to platform.

Signed-off-by: Silvin Lubecki <[email protected]>
  • Loading branch information
silvin-lubecki committed Mar 22, 2019
1 parent b6c3e2e commit 96c81d4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ type LocationRef struct {

// BaseImage contains fields shared across image types
type BaseImage struct {
ImageType string `json:"imageType" mapstructure:"imageType"`
Image string `json:"image" mapstructure:"image"`
Digest string `json:"digest,omitempty" mapstructure:"digest"`
Size uint64 `json:"size,omitempty" mapstructure:"size"`
Platform ImagePlatform `json:"platform,omitempty" mapstructure:"platform"`
MediaType string `json:"mediaType,omitempty" mapstructure:"mediaType"`
ImageType string `json:"imageType" mapstructure:"imageType"`
Image string `json:"image" mapstructure:"image"`
Digest string `json:"digest,omitempty" mapstructure:"digest"`
Size uint64 `json:"size,omitempty" mapstructure:"size"`
Platform *ImagePlatform `json:"platform,omitempty" mapstructure:"platform"`
MediaType string `json:"mediaType,omitempty" mapstructure:"mediaType"`
}

// ImagePlatform indicates what type of platform an image is built for
Expand Down

0 comments on commit 96c81d4

Please sign in to comment.