VasuDevrani / artifact-explorer-oras

6 stars 2 forks source link

don't reorder manifest JSON properties #46

Closed qweeah closed 1 year ago

qweeah commented 1 year ago

Taking ghcr.io/qweeah/oras:foo as an example, the manifest JSON is

{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.unknown.config.v1+json","digest":"sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a","size":2},"layers":[{"mediaType":"application/vnd.oci.image.layer.v1.tar","digest":"sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","size":0,"annotations":{"org.opencontainers.image.title":"foo"}}],"annotations":{"org.opencontainers.image.created":"2023-07-12T04:13:53Z"}}

The prettified output of oras manifest fetch is:

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "config": {
    "mediaType": "application/vnd.unknown.config.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar",
      "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "size": 0,
      "annotations": {
        "org.opencontainers.image.title": "foo"
      }
    }
  ],
  "annotations": {
    "org.opencontainers.image.created": "2023-07-12T04:13:53Z"
  }
}

Please notice that the order of the fields are not changed.

Artifact explorer should output similar JSON like oras output. Currently the fields are sorted alphabetically, which is different to spec's guide. image