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

Commit

Permalink
Add spec for Artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: Aviral Takkar <aviral26@users.noreply.github.com>
  • Loading branch information
aviral26 committed Mar 24, 2021
1 parent 9d10a67 commit 8a7199b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
27 changes: 27 additions & 0 deletions specs-go/v2/artifact.go
Original file line number Diff line number Diff line change
@@ -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"`
}
6 changes: 6 additions & 0 deletions specs-go/v2/artifacttype.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package v2

const (
// ArtifactTypeNotaryV2 specifies the artifact type for a notary V2 object.
ArtifactTypeNotaryV2 = "application/vnd.cncf.notary.v2"
)
4 changes: 2 additions & 2 deletions specs-go/v2/mediatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
9 changes: 9 additions & 0 deletions specs-go/versioned.go
Original file line number Diff line number Diff line change
@@ -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"`
}

0 comments on commit 8a7199b

Please sign in to comment.