From 7761a70389cc3a6a2296856a1e1e7d46aca27bee Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Mon, 18 Jan 2016 10:19:36 -0800 Subject: [PATCH] Add information about manifest content types to API spec Bring the spec up to date for schema2 changes. Signed-off-by: Aaron Lehmann --- docs/spec/api.md | 21 ++++++++++++++++++--- docs/spec/api.md.tmpl | 17 ++++++++++++++++- registry/api/v2/descriptors.go | 4 ++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/docs/spec/api.md b/docs/spec/api.md index ce4f0234..9e5066e7 100644 --- a/docs/spec/api.md +++ b/docs/spec/api.md @@ -125,6 +125,13 @@ reference and shouldn't be used outside the specification other than to identify a set of modifications.
+
k
+
+
    +
  • Document use of Accept and Content-Type headers in manifests endpoint.
  • +
+
+
j
    @@ -408,6 +415,11 @@ GET /v2//manifests/ The `name` and `reference` parameter identify the image and are required. The reference may include a tag or digest. +The client should include an Accept header indicating which manifest content +types it supports. For more details on the manifest formats and their content +types, see manifest-v2-1.md and manifest-v2-2.md. In a successful response, +the Content-Type header will indicate which manifest type is being returned. + A `404 Not Found` response will be returned if the image is unknown to the registry. If the image exists and the response is successful, the image manifest will be returned, with the following format (see docker/docker#8093 @@ -822,6 +834,7 @@ Once all of the layers for an image are uploaded, the client can upload the image manifest. An image can be pushed using the following request format: PUT /v2//manifests/ + Content-Type: { "name": , @@ -839,7 +852,9 @@ image manifest. An image can be pushed using the following request format: } The `name` and `reference` fields of the response body must match those specified in -the URL. The `reference` field may be a "tag" or a "digest". +the URL. The `reference` field may be a "tag" or a "digest". The content type +should match the type of the manifest being uploaded, as specified in +manifest-v2-1.md and manifest-v2-2.md. If there is a problem with pushing the manifest, a relevant 4xx response will be returned with a JSON error message. Please see the _PUT Manifest section @@ -1605,7 +1620,7 @@ The following parameters should be specified on the request: ``` 200 OK Docker-Content-Digest: -Content-Type: application/json; charset=utf-8 +Content-Type: { "name": , @@ -1788,7 +1803,7 @@ Put the manifest identified by `name` and `reference` where `reference` can be a PUT /v2//manifests/ Host: Authorization: -Content-Type: application/json; charset=utf-8 +Content-Type: { "name": , diff --git a/docs/spec/api.md.tmpl b/docs/spec/api.md.tmpl index 544b0bfe..eb59667b 100644 --- a/docs/spec/api.md.tmpl +++ b/docs/spec/api.md.tmpl @@ -125,6 +125,13 @@ reference and shouldn't be used outside the specification other than to identify a set of modifications.
    +
    k
    +
    +
      +
    • Document use of Accept and Content-Type headers in manifests endpoint.
    • +
    +
    +
    j
      @@ -408,6 +415,11 @@ GET /v2//manifests/ The `name` and `reference` parameter identify the image and are required. The reference may include a tag or digest. +The client should include an Accept header indicating which manifest content +types it supports. For more details on the manifest formats and their content +types, see manifest-v2-1.md and manifest-v2-2.md. In a successful response, +the Content-Type header will indicate which manifest type is being returned. + A `404 Not Found` response will be returned if the image is unknown to the registry. If the image exists and the response is successful, the image manifest will be returned, with the following format (see docker/docker#8093 @@ -822,6 +834,7 @@ Once all of the layers for an image are uploaded, the client can upload the image manifest. An image can be pushed using the following request format: PUT /v2//manifests/ + Content-Type: { "name": , @@ -839,7 +852,9 @@ image manifest. An image can be pushed using the following request format: } The `name` and `reference` fields of the response body must match those specified in -the URL. The `reference` field may be a "tag" or a "digest". +the URL. The `reference` field may be a "tag" or a "digest". The content type +should match the type of the manifest being uploaded, as specified in +manifest-v2-1.md and manifest-v2-2.md. If there is a problem with pushing the manifest, a relevant 4xx response will be returned with a JSON error message. Please see the _PUT Manifest section diff --git a/registry/api/v2/descriptors.go b/registry/api/v2/descriptors.go index ad3da3ef..db52ba2e 100644 --- a/registry/api/v2/descriptors.go +++ b/registry/api/v2/descriptors.go @@ -514,7 +514,7 @@ var routeDescriptors = []RouteDescriptor{ digestHeader, }, Body: BodyDescriptor{ - ContentType: "application/json; charset=utf-8", + ContentType: "", Format: manifestBody, }, }, @@ -553,7 +553,7 @@ var routeDescriptors = []RouteDescriptor{ referenceParameterDescriptor, }, Body: BodyDescriptor{ - ContentType: "application/json; charset=utf-8", + ContentType: "", Format: manifestBody, }, Successes: []ResponseDescriptor{