Skip to content

Commit 8f27a02

Browse files
authored
Merge pull request #620 from stevvooe/unify-descriptor-type
specs-go/v1: unify the descriptor type
2 parents 3ff2369 + 572e6ae commit 8f27a02

File tree

2 files changed

+34
-36
lines changed

2 files changed

+34
-36
lines changed

specs-go/v1/descriptor.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ package v1
1717
import digest "github.com/opencontainers/go-digest"
1818

1919
// Descriptor describes the disposition of targeted content.
20-
// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype when marshalled to JSON
20+
// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype
21+
// when marshalled to JSON.
2122
type Descriptor struct {
2223
// MediaType is the media type of the object this schema refers to.
2324
MediaType string `json:"mediaType,omitempty"`
@@ -33,4 +34,35 @@ type Descriptor struct {
3334

3435
// Annotations contains arbitrary metadata relating to the targeted content.
3536
Annotations map[string]string `json:"annotations,omitempty"`
37+
38+
// Platform describes the platform which the image in the manifest runs on.
39+
//
40+
// This should only be used when referring to a manifest.
41+
Platform *Platform `json:"platform,omitempty"`
42+
}
43+
44+
// Platform describes the platform which the image in the manifest runs on.
45+
type Platform struct {
46+
// Architecture field specifies the CPU architecture, for example
47+
// `amd64` or `ppc64`.
48+
Architecture string `json:"architecture"`
49+
50+
// OS specifies the operating system, for example `linux` or `windows`.
51+
OS string `json:"os"`
52+
53+
// OSVersion is an optional field specifying the operating system
54+
// version, for example `10.0.10586`.
55+
OSVersion string `json:"os.version,omitempty"`
56+
57+
// OSFeatures is an optional field specifying an array of strings,
58+
// each listing a required OS feature (for example on Windows `win32k`).
59+
OSFeatures []string `json:"os.features,omitempty"`
60+
61+
// Variant is an optional field specifying a variant of the CPU, for
62+
// example `ppc64le` to specify a little-endian version of a PowerPC CPU.
63+
Variant string `json:"variant,omitempty"`
64+
65+
// Features is an optional field specifying an array of strings, each
66+
// listing a required CPU feature (for example `sse4` or `aes`).
67+
Features []string `json:"features,omitempty"`
3668
}

specs-go/v1/index.go

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,13 @@ package v1
1616

1717
import "github.com/opencontainers/image-spec/specs-go"
1818

19-
// Platform describes the platform which the image in the manifest runs on.
20-
type Platform struct {
21-
// Architecture field specifies the CPU architecture, for example
22-
// `amd64` or `ppc64`.
23-
Architecture string `json:"architecture"`
24-
25-
// OS specifies the operating system, for example `linux` or `windows`.
26-
OS string `json:"os"`
27-
28-
// OSVersion is an optional field specifying the operating system
29-
// version, for example `10.0.10586`.
30-
OSVersion string `json:"os.version,omitempty"`
31-
32-
// OSFeatures is an optional field specifying an array of strings,
33-
// each listing a required OS feature (for example on Windows `win32k`).
34-
OSFeatures []string `json:"os.features,omitempty"`
35-
36-
// Variant is an optional field specifying a variant of the CPU, for
37-
// example `ppc64le` to specify a little-endian version of a PowerPC CPU.
38-
Variant string `json:"variant,omitempty"`
39-
40-
// Features is an optional field specifying an array of strings, each
41-
// listing a required CPU feature (for example `sse4` or `aes`).
42-
Features []string `json:"features,omitempty"`
43-
}
44-
45-
// ManifestDescriptor describes a platform specific manifest.
46-
type ManifestDescriptor struct {
47-
Descriptor
48-
49-
// Platform describes the platform which the image in the manifest runs on.
50-
Platform *Platform `json:"platform,omitempty"`
51-
}
52-
5319
// Index references manifests for various platforms.
5420
// This structure provides `application/vnd.oci.image.index.v1+json` mediatype when marshalled to JSON.
5521
type Index struct {
5622
specs.Versioned
5723

5824
// Manifests references platform specific manifests.
59-
Manifests []ManifestDescriptor `json:"manifests"`
25+
Manifests []Descriptor `json:"manifests"`
6026

6127
// Annotations contains arbitrary metadata for the image index.
6228
Annotations map[string]string `json:"annotations,omitempty"`

0 commit comments

Comments
 (0)