Skip to content

Conversation

@zhouhao3
Copy link

Signed-off-by: zhouhao [email protected]

@jonboulle
Copy link
Contributor

jonboulle commented Mar 10, 2017

@vbatts
Copy link
Member

vbatts commented Mar 10, 2017

LGTM

Approved with PullApprove

@vbatts vbatts merged commit a3500d5 into opencontainers:master Mar 10, 2017
vishvananda added a commit to vishvananda/image-spec that referenced this pull request Mar 28, 2017
The spec states that platform is an optional field for the items in the
image index. Pull request opencontainers#607 added omitempty to the field, but
omitempty only works for types with a zero value. Because Platform is a
struct, it will never be omitted. The platform field should instead be a
pointer so that it can be properly omitted when it has no value.
Currently, serializing an index.json without populating platform leads to
something like the following:

{
  "schemaVersion": 2,
  "manifests": [
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest":
"sha256:d73e0d70cb05a373b5a666ba608139624d90a88d0155d2ade06a6001a27cd8d5",
      "size": 348,
      "platform": {
        "architecture": "",
        "os": ""
      }
    }
  ]
}

With the change in this patch, leaving platform as nil will cause it to
be omitted as expected.

Signed-off-by: Vishvananda Ishaya Abrams <[email protected]>
@zhouhao3 zhouhao3 deleted the plat-omit branch April 5, 2017 01:09
@vbatts vbatts mentioned this pull request May 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants