Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Commit 8a7199b

Browse files
committed
Add spec for Artifacts
Signed-off-by: Aviral Takkar <[email protected]>
1 parent 9d10a67 commit 8a7199b

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

specs-go/v2/artifact.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package v2
2+
3+
import "github.com/opencontainers/artifacts/specs-go"
4+
5+
// Artifact describes a registry artifact.
6+
// This structure provides `application/vnd.oci.artifact.manifest.v1+json` mediatype when marshalled to JSON.
7+
type Artifact struct {
8+
specs.Versioned
9+
10+
// MediaType is the media type of the object this schema refers to.
11+
MediaType string `json:"mediaType"`
12+
13+
// ArtifactType is the artifact type of the object this schema refers to.
14+
ArtifactType string `json:"artifactType"`
15+
16+
// Config references the index configuration.
17+
Config Descriptor `json:"config"`
18+
19+
// Blobs is a collection of blobs referenced by this manifest.
20+
Blobs []Descriptor `json:"blobs"`
21+
22+
// Manifests is a collection of manifests this artifact is linked to.
23+
Manifests []Descriptor `json:"manifests"`
24+
25+
// Annotations contains arbitrary metadata for the artifact manifest.
26+
Annotations map[string]string `json:"annotations,omitempty"`
27+
}

specs-go/v2/artifacttype.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v2
2+
3+
const (
4+
// ArtifactTypeNotaryV2 specifies the artifact type for a notary V2 object.
5+
ArtifactTypeNotaryV2 = "application/vnd.cncf.notary.v2"
6+
)

specs-go/v2/mediatype.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
package v2
1616

1717
const (
18-
// MediaTypeImageIndex specifies the media type for an image index.
19-
MediaTypeImageIndex = "application/vnd.oci.image.index.v2+json"
18+
// MediaTypeArtifact specifies the media type for an OCI artifact.
19+
MediaTypeArtifact = "application/vnd.oci.artifact.manifest.v1+json"
2020
)

specs-go/versioned.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package specs
2+
3+
// Versioned provides a struct with the manifest schemaVersion and mediaType.
4+
// Incoming content with unknown schema version can be decoded against this
5+
// struct to check the version.
6+
type Versioned struct {
7+
// SchemaVersion is the image manifest schema that this image follows
8+
SchemaVersion int `json:"schemaVersion"`
9+
}

0 commit comments

Comments
 (0)