postImagesCreate does actually produce JSON sequence (rfc7464).#43157
postImagesCreate does actually produce JSON sequence (rfc7464).#43157ndeloof wants to merge 7 commits intomoby:masterfrom
Conversation
|
Thanks! I seem to recall we made some changes in the content-type in the past that we had to revert as it broke some things. I'll have to dig into history for that though. Perhaps it should perform content-negotiation, and depending on what the client advertises, use one or the other. |
|
I also wondered about the potential impact changing the |
|
Yes, I was thinking along those lines indeed. When doing so, I think there's some utility package that we already use somewhere to make sure we parse These responses were always a bit "hairy" because when we implemented them, it was not really an official RFC yet, so there was no official content-type (other than some conventions used by some). |
|
Ah, yes, this was the one; moby/api/server/router/container/copy.go Line 94 in 7b9275c That same packages also has a |
|
(that code was part of the |
|
IIUC Kubernetes uses bitbucket.org/ww/goautoneg, so seems a reasonable dependency to be added to align with other projects in our ecosystem, wdyt? |
|
Thanks! So ... it looks like the bitbucket.org/ww/goautoneg package went AWOL, and they switch to a fork of it in kubernetes/kubernetes@16fd72d (switching to https://github.com/munnerz/goautoneg). What slightly concerns me is that it feels a bit like they "just picked a fork of the original one", which is in a personal repository (not an org) and the owner apparently just made a fork, but is not a real expert on the code itself munnerz/goautoneg#3 (review)
Not saying we shouldn't switch to that package, but based on the above, I think it'd be good to have a good look how the implementation differs from what' we're currently using (if it's considerably better) before deciding whether or not we should switch. We could continue to use the current implementation (for now), and look for a possible replacement in a follow-up. |
|
oh ok, I didn't checked the status of this dependency, makes perfect sense to keep our current implementation then, until the other ones demonstrates to be somehow a better one (?). Thanks for digging into this |
c1be211 to
e777f4b
Compare
|
Thanks! We briefly went through this PR in the maintainers meeting, and we're good with this change in general. I want to have another look, to look more into detail, but from an earlier glance (some of this could be in a follow-up);
|
|
swagger doesn't offer an explicit way to declare content-negotiation, but allows to define multiple values for produced content that a consumer can use to define |
|
Doesn't (Also, I'm not sure it matters technically, but the two swagger changes here appear to use different orderings in |
|
@tianon correct. I need to check how we can get |
|
Before I forget; now that this PR needs updating, can you also add a note to the API history, and mention the new content-types / response types for these endpoints? https://github.com/moby/moby/blob/master/docs/api/version-history.md |
7c11913 to
4a8ea79
Compare
12cd2f0 to
93b1731
Compare
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
…t accordingly Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
thaJeztah
left a comment
There was a problem hiding this comment.
LOL; had some comment pending it says
| - "application/octet-stream" | ||
| produces: | ||
| - "application/json" | ||
| - "application/json-seq" |
There was a problem hiding this comment.
Does swagger allow specifying both content types here (like it does for consumes)?
|
Closing as obsolete |
- What I did
Changed
Content-typeproduced bypostImagesCreateto adopt RFC7464 as an explicit mime typeapplication/json-seq. The produced event stream is not a valid JSON object, soapplication/jsonshould not be used.- How I did it
Updated produced mime type
- How to verify it
curl -v --unix-socket /var/run/docker.sock -X POST http:/v1.41/images/create?fromImage=busybox
- Description for the changelog
Make it more explicit
images/createproduces JSON event sequence by adopting RFC7464 mime typeapplication/json-seq.- A picture of a cute animal (not mandatory but encouraged)
