Move MediaType into manifest.Versioned
This makes content type sniffing cleaner. The document just needs to be decoded into a manifest.Versioned structure. It's no longer a two-step process. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
697af09566
commit
6d17423a6d
7 changed files with 11 additions and 23 deletions
|
@ -17,6 +17,7 @@ const MediaTypeManifestList = "application/vnd.docker.distribution.manifest.list
|
|||
// packages version of the manifest.
|
||||
var SchemaVersion = manifest.Versioned{
|
||||
SchemaVersion: 2,
|
||||
MediaType: MediaTypeManifestList,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -68,10 +69,6 @@ type ManifestDescriptor struct {
|
|||
type ManifestList struct {
|
||||
manifest.Versioned
|
||||
|
||||
// MediaType is the media type of this document. It should always
|
||||
// be set to MediaTypeManifestList.
|
||||
MediaType string `json:"mediaType"`
|
||||
|
||||
// Config references the image configuration as a blob.
|
||||
Manifests []ManifestDescriptor `json:"manifests"`
|
||||
}
|
||||
|
@ -102,7 +99,6 @@ type DeserializedManifestList struct {
|
|||
func FromDescriptors(descriptors []ManifestDescriptor) (*DeserializedManifestList, error) {
|
||||
m := ManifestList{
|
||||
Versioned: SchemaVersion,
|
||||
MediaType: MediaTypeManifestList,
|
||||
}
|
||||
|
||||
m.Manifests = make([]ManifestDescriptor, len(descriptors), len(descriptors))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue