-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
specs-go: clarify mediatypes #411
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ type History struct { | |
} | ||
|
||
// Image is the JSON structure which describes some basic information about the image. | ||
// This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is annoying that this one is inconsistent. Can't we safely add a media type field to it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i was thinking the same. Especially since the field is omitEmpty for JSON. Perhaps make it optional with a SHOULD, so it will have compat with older docker? Thoughts @stevvooe ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (to that end, also the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Fri, Oct 21, 2016 at 07:12:12AM -0700, Vincent Batts wrote:
+1 to assigning a media type to On Fri, Oct 21, 2016 at 06:59:20AM -0700, Jonathan Boulle wrote:
This is going the wrong way. If folks want to look inside inside the blob and try to guess its type (e.g. by unmarshalling into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jonboulle In general, we should not actually be embedding mediaTypes in the target types. The mediaType is a lens to the data. Really, we should remove them from the types. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The only time I can see where we'd want this to be the recommended method for typing a blob is in signed assertions. For everything else, I'd rather have:
Instead of:
And again, I'm just arguing that we shouldn't be using peek-inside typing for image unpacking, etc. I'm ok with us deciding that we want to use it to save keystrokes on pre-CAS-push validation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wking You're arguing that there's dichotomy between "free for all, no need to have The benefit of being able to know what a JSON blob is meant to represent is entirely separate from "I can tell what every blob in the image is without references". If you're not happy with detecting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You're saying “assuming (for some out-of-band reason) that the blob is a JSON object which contains a self-describing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Your consistent implication that all consumers will have access to the entire image is getting annoying. If I have a tool like Now, you might argue that we should send the out-of-band media type with it. But why should that be a requirement? What are you gaining by removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's exactly what I'll argue ;). And unless you implement completely generic peek-inside detection (which I don't think anyone's arguing for), you're going to have to transmit some amount of media-type guidance along with your blob content. I'm suggesting that guidance be the media type. You seem to be suggesting that that guidance be “this blob is a JSON object which contains a self-describing
I'm not suggesting we remove I'm just suggesting image-handling tools follow the spec's SHOULD and use descriptors to reference blob content, with peek-inside type detection being reserved for signed-assertions. And having acquired the media type from the referencing descriptor (or because we authored the blob ourselves), I see no need for image-handling tools to use peek-inside type detection. Perhaps our difference here is that I see (almost) all tooling as being descriptor-based, while you see the tooling as being isolated-blob based. Since I'm fine leaving existing |
||
type Image struct { | ||
// Created defines an ISO-8601 formatted combined date and time at which the image was created. | ||
Created string `json:"created,omitempty"` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,8 @@ type ManifestDescriptor struct { | |
Platform Platform `json:"platform"` | ||
} | ||
|
||
// ManifestList references manifests for various platforms. | ||
// ManifestList references manifests for various platforms. | ||
// This structure provides `application/vnd.oci.image.manifest.list.v1+json` mediatype when marshalled to JSON. | ||
type ManifestList struct { | ||
specs.Versioned | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, technically. Does not change anything and is very apparent that it is media typed |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems awkward. I'd expect "reserved" to mean "configs MUST NOT set this property, and we haven't assigned semantics to it". If it is optional and has defined semantics, what do you intend to change by reserving it too?
I think we'll have better Docker compatibility if we drop this property from the spec entirely (except for
descriptor.mediaType
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda agree, this confused me on my read-through. Can we just say something like:
and leave it at that.