Skip to content

Commit d1c7054

Browse files
authored
Merge pull request #411 from vbatts/mediatyped
specs-go: clarify mediatypes
2 parents 7ccc18a + 5fc84e5 commit d1c7054

File tree

10 files changed

+15
-32
lines changed

10 files changed

+15
-32
lines changed

image-layout.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Object names in the `refs` subdirectories MUST NOT include characters outside of
5959

6060
No semantic restriction is given for object names in the `refs` subdirectory.
6161
Each object in the `refs` subdirectory MUST be of type `application/vnd.oci.descriptor.v1+json`.
62-
In general the `mediatype` of this [descriptor][descriptors] object will be either `application/vnd.oci.image.manifest.list.v1+json` or `application/vnd.oci.image.manifest.v1+json` although future versions of the spec MAY use a different mediatype.
62+
In general the `mediaType` of this [descriptor][descriptors] object will be either `application/vnd.oci.image.manifest.list.v1+json` or `application/vnd.oci.image.manifest.v1+json` although future versions of the spec MAY use a different mediatype.
6363

6464
**Implementor's Note:**
6565
A common use case of refs is representing "tags" for a container image.
@@ -97,7 +97,6 @@ The blobs directory MAY be missing referenced blobs, in which case the missing b
9797
$ cat ./blobs/sha256/e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f | jq
9898
{
9999
"schemaVersion": 2,
100-
"mediaType": "application/vnd.oci.image.manifest.list.v1+json",
101100
"manifests": [
102101
{
103102
"mediaType": "application/vnd.oci.image.manifest.v1+json",
@@ -115,7 +114,6 @@ $ cat ./blobs/sha256/e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7f
115114
$ cat ./blobs/sha256/afff3924849e458c5ef237db5f89539274d5e609db5db935ed3959c90f1f2d51 | jq
116115
{
117116
"schemaVersion": 2,
118-
"mediaType": "application/vnd.oci.image.manifest.v1+json",
119117
"config": [
120118
"mediaType": "application/vnd.oci.image.config.v1+json",
121119
"size": 7023,

manifest-list.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ The manifest list is a higher-level manifest which points to specific [image man
44
While the use of a manifest list is OPTIONAL for image providers, image consumers SHOULD be prepared to process them.
55

66
This section defines the `application/vnd.oci.image.manifest.list.v1+json` [media type](media-types.md).
7+
For the media type(s) that this document is compatible with, see the [matrix][matrix].
78

89
## *Manifest List* Property Descriptions
910

@@ -14,9 +15,8 @@ This section defines the `application/vnd.oci.image.manifest.list.v1+json` [medi
1415

1516
- **`mediaType`** *string*
1617

17-
This REQUIRED property contains the media type of the manifest list.
18-
For this version of the specification, this MUST be set to `application/vnd.oci.image.manifest.list.v1+json`.
19-
For the media type(s) that this is compatible with, see the [matrix](media-types.md#compatibility-matrix).
18+
This property is *reserved* for use, to [maintain compatibility][matrix].
19+
When used, this field contains the media type of this document, which differs from the [descriptor](descriptor.md#properties) use of `mediaType`.
2020

2121
- **`manifests`** *array of objects*
2222

@@ -119,3 +119,4 @@ Instead they MUST ignore unknown properties.
119119
```
120120

121121
[runtime-platform2]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc2/config.md#platform
122+
[matrix]: media-types.md#compatibility-matrix

manifest.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ In OCI, this is codified in a [Manifest List](manifest-list.md).
77
The third goal is to be translatable to the [OCI Runtime Specification](https://github.com/opencontainers/runtime-spec).
88

99
This section defines the `application/vnd.oci.image.manifest.v1+json` [media type](media-types.md).
10+
For the media type(s) that this is compatible with see the [matrix](media-types.md#compatibility-matrix).
1011

1112
# Image Manifest
1213

@@ -21,9 +22,8 @@ Unlike the [Manifest List](manifest-list.md), which contains information about a
2122

2223
- **`mediaType`** *string*
2324

24-
This REQUIRED property contains the media type of the image manifest.
25-
For this version of the specification, this MUST be set to `application/vnd.oci.image.manifest.v1+json`.
26-
For the media type(s) that this is compatible with see the [matrix](media-types.md#compatibility-matrix).
25+
This property is *reserved* for use, to [maintain compatibility][matrix].
26+
When used, this field contains the media type of this document, which differs from the [descriptor](descriptor.md#properties) use of `mediaType`.
2727

2828
- **`config`** *[descriptor](descriptor.md)*
2929

schema/image-manifest-schema.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
"minimum": 2,
1212
"maximum": 2
1313
},
14-
"mediaType": {
15-
"id": "https://opencontainers.org/schema/image/manifest/mediaType",
16-
"type": "string",
17-
"enum": [
18-
"application/vnd.oci.image.manifest.v1+json"
19-
]
20-
},
2114
"config": {
2215
"$ref": "content-descriptor.json"
2316
},
@@ -35,7 +28,6 @@
3528
},
3629
"required": [
3730
"schemaVersion",
38-
"mediaType",
3931
"config",
4032
"layers"
4133
]

schema/manifest-list-schema.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
"minimum": 2,
1212
"maximum": 2
1313
},
14-
"mediaType": {
15-
"id": "https://opencontainers.org/schema/image/manifest-list/mediaType",
16-
"type": "string",
17-
"enum": [
18-
"application/vnd.oci.image.manifest.list.v1+json"
19-
]
20-
},
2114
"manifests": {
2215
"type": "array",
2316
"items": {
@@ -31,7 +24,6 @@
3124
},
3225
"required": [
3326
"schemaVersion",
34-
"mediaType",
3527
"manifests"
3628
]
3729
}

specs-go/v1/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type History struct {
6969
}
7070

7171
// Image is the JSON structure which describes some basic information about the image.
72+
// This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON.
7273
type Image struct {
7374
// Created defines an ISO-8601 formatted combined date and time at which the image was created.
7475
Created string `json:"created,omitempty"`

specs-go/v1/descriptor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
package v1
1616

1717
// Descriptor describes the disposition of targeted content.
18+
// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype when marshalled to JSON
1819
type Descriptor struct {
19-
// MediaType contains the MIME type of the referenced object.
20-
MediaType string `json:"mediaType"`
20+
// MediaType is the media type of the object this schema refers to.
21+
MediaType string `json:"mediaType,omitempty"`
2122

2223
// Digest is the digest of the targeted content.
2324
Digest string `json:"digest"`

specs-go/v1/manifest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package v1
1616

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

19-
// Manifest defines a schema2 manifest
19+
// Manifest provides `application/vnd.oci.image.manifest.list.v1+json` mediatype structure when marshalled to JSON.
2020
type Manifest struct {
2121
specs.Versioned
2222

specs-go/v1/manifest_list.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ type ManifestDescriptor struct {
5050
Platform Platform `json:"platform"`
5151
}
5252

53-
// ManifestList references manifests for various platforms.
53+
// ManifestList references manifests for various platforms.
54+
// This structure provides `application/vnd.oci.image.manifest.list.v1+json` mediatype when marshalled to JSON.
5455
type ManifestList struct {
5556
specs.Versioned
5657

specs-go/versioned.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@ package specs
2020
type Versioned struct {
2121
// SchemaVersion is the image manifest schema that this image follows
2222
SchemaVersion int `json:"schemaVersion"`
23-
24-
// MediaType is the media type of this schema.
25-
MediaType string `json:"mediaType"`
2623
}

0 commit comments

Comments
 (0)