Skip to content

Commit 5d7ba05

Browse files
authored
Merge pull request #1077 from sajayantony/index-artifacts
image-index: add artifactType to specs and schema
2 parents 9708013 + a845c7a commit 5d7ba05

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

schema/image-index-schema.json

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"description": "the mediatype of the referenced object",
1616
"$ref": "defs-descriptor.json#/definitions/mediaType"
1717
},
18+
"artifactType": {
19+
"description": "the artifact mediatype of the referenced object",
20+
"$ref": "defs-descriptor.json#/definitions/mediaType"
21+
},
1822
"subject": {
1923
"$ref": "content-descriptor.json"
2024
},

schema/imageindex_test.go

+25
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,31 @@ func TestImageIndex(t *testing.T) {
227227
}
228228
]
229229
}
230+
`,
231+
fail: false,
232+
},
233+
234+
// valid image index with artifactType and manifests
235+
{
236+
imageIndex: `
237+
{
238+
"schemaVersion": 2,
239+
"mediaType" : "application/vnd.oci.image.index.v1+json",
240+
"artifactType": "application/vnd.example+type",
241+
"manifests": [
242+
{
243+
"mediaType": "application/vnd.oci.image.manifest.v1+json",
244+
"size": 7143,
245+
"digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270"
246+
},
247+
{
248+
"mediaType": "application/vnd.oci.image.manifest.v1+json",
249+
"artifactType": "application/vnd.example1+type",
250+
"size": 506,
251+
"digest": "sha256:99953afc4b90c7d78079d189ae10da0a1002e6be5e9e8dedaf9f7f29def42111"
252+
}
253+
]
254+
}
230255
`,
231256
fail: false,
232257
},

specs-go/v1/index.go

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ type Index struct {
2424
// MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json`
2525
MediaType string `json:"mediaType,omitempty"`
2626

27+
// ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact.
28+
ArtifactType string `json:"artifactType,omitempty"`
29+
2730
// Manifests references platform specific manifests.
2831
Manifests []Descriptor `json:"manifests"`
2932

0 commit comments

Comments
 (0)