diff --git a/specs-go/v2/artifact.go b/specs-go/v2/artifact.go new file mode 100644 index 0000000..96e707a --- /dev/null +++ b/specs-go/v2/artifact.go @@ -0,0 +1,27 @@ +package v2 + +import "github.com/opencontainers/artifacts/specs-go" + +// Artifact describes a registry artifact. +// This structure provides `application/vnd.oci.artifact.manifest.v1+json` mediatype when marshalled to JSON. +type Artifact struct { + specs.Versioned + + // MediaType is the media type of the object this schema refers to. + MediaType string `json:"mediaType"` + + // ArtifactType is the artifact type of the object this schema refers to. + ArtifactType string `json:"artifactType"` + + // Config references the index configuration. + Config Descriptor `json:"config"` + + // Blobs is a collection of blobs referenced by this manifest. + Blobs []Descriptor `json:"blobs"` + + // Manifests is a collection of manifests this artifact is linked to. + Manifests []Descriptor `json:"manifests"` + + // Annotations contains arbitrary metadata for the artifact manifest. + Annotations map[string]string `json:"annotations,omitempty"` +} diff --git a/specs-go/v2/artifacttype.go b/specs-go/v2/artifacttype.go new file mode 100644 index 0000000..7f116c0 --- /dev/null +++ b/specs-go/v2/artifacttype.go @@ -0,0 +1,6 @@ +package v2 + +const ( + // ArtifactTypeNotaryV2 specifies the artifact type for a notary V2 object. + ArtifactTypeNotaryV2 = "application/vnd.cncf.notary.v2" +) diff --git a/specs-go/v2/mediatype.go b/specs-go/v2/mediatype.go index 08dd4a9..7d8caa9 100644 --- a/specs-go/v2/mediatype.go +++ b/specs-go/v2/mediatype.go @@ -15,6 +15,6 @@ package v2 const ( - // MediaTypeImageIndex specifies the media type for an image index. - MediaTypeImageIndex = "application/vnd.oci.image.index.v2+json" + // MediaTypeArtifact specifies the media type for an OCI artifact. + MediaTypeArtifact = "application/vnd.oci.artifact.manifest.v1+json" ) diff --git a/specs-go/versioned.go b/specs-go/versioned.go new file mode 100644 index 0000000..f865cb2 --- /dev/null +++ b/specs-go/versioned.go @@ -0,0 +1,9 @@ +package specs + +// Versioned provides a struct with the manifest schemaVersion and mediaType. +// Incoming content with unknown schema version can be decoded against this +// struct to check the version. +type Versioned struct { + // SchemaVersion is the image manifest schema that this image follows + SchemaVersion int `json:"schemaVersion"` +}