Skip to content

Commit 8d013c4

Browse files
committed
docs/api: document /_ping?capabilities=v1 endpoint
We've added a query parameter `capabilities` to the `/_ping` endpoint that allows clients to request capabilities that the engine supports in the `/_ping` response. Document this change in `docs/api/version-history.md`, and update the swagger yaml accordingly. For Swagger, I've added a "separate" endpoint documenting the new behavior. This has to do with Swagger not supporting different responses for the same path (either based on query params or content-types/other headers) – see OAI/OpenAPI-Specification#146 This is supported in OpenAPI 3.0 (OAI/OpenAPI-Specification#146 (comment)), so we could fix this up in the future. Signed-off-by: Laura Brehm <[email protected]>
1 parent 43196fc commit 8d013c4

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

api/swagger.yaml

+88
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ tags:
173173
x-displayName: "System"
174174

175175
definitions:
176+
Capabilities:
177+
description: "Represents engine capabilities"
178+
type: "object"
179+
required: ["registry-client-auth"]
180+
properties:
181+
registry-client-auth:
182+
description: "Whether the engine supports client auth handling."
183+
type: "boolean"
184+
x-nullable: false
185+
example:
186+
registry-client-auth: true
176187
Port:
177188
type: "object"
178189
description: "An open port on a container"
@@ -9709,6 +9720,83 @@ paths:
97099720
schema:
97109721
$ref: "#/definitions/ErrorResponse"
97119722
tags: ["System"]
9723+
# Using a zero-width character here to define a separate /_ping endpoint to describe the
9724+
# /_ping?features=v1 API since otherwise Swagger won't allow us to define multiple
9725+
# responses for the same endpoint depending on query parameter.
9726+
# This is however supported by OpenAPI v3.
9727+
# See: https://github.com/OAI/OpenAPI-Specification/issues/146
9728+
# and https://github.com/OAI/OpenAPI-Specification/issues/182
9729+
/_ping​:
9730+
get:
9731+
summary: "/_ping?capabilities=v1"
9732+
description: |
9733+
This is the same endpoint as `GET /_ping`, but describes the different
9734+
response when it is called with the `capabilities=v1` query parameter.
9735+
9736+
In this case, the daemon instead responds with a `Content-Type` of
9737+
`application/json` and writes a json represenation of the engine's
9738+
capabilities in the response body.
9739+
operationId: "SystemPingCapabilities"
9740+
produces: ["application/json"]
9741+
parameters:
9742+
- name: "capabilities"
9743+
in: "query"
9744+
description: |
9745+
TODO
9746+
# marked as required since this is a separate endpoint in the swagger yaml.
9747+
required: true
9748+
type: "string"
9749+
enum: ["v1"]
9750+
responses:
9751+
200:
9752+
description: "no error"
9753+
schema:
9754+
$ref: "#/definitions/Capabilities"
9755+
headers:
9756+
API-Version:
9757+
type: "string"
9758+
description: "Max API Version the server supports"
9759+
Builder-Version:
9760+
type: "string"
9761+
description: |
9762+
Default version of docker image builder
9763+
9764+
The default on Linux is version "2" (BuildKit), but the daemon
9765+
can be configured to recommend version "1" (classic Builder).
9766+
Windows does not yet support BuildKit for native Windows images,
9767+
and uses "1" (classic builder) as a default.
9768+
9769+
This value is a recommendation as advertised by the daemon, and
9770+
it is up to the client to choose which builder to use.
9771+
default: "2"
9772+
Docker-Experimental:
9773+
type: "boolean"
9774+
description: "If the server is running with experimental mode enabled"
9775+
Swarm:
9776+
type: "string"
9777+
enum: ["inactive", "pending", "error", "locked", "active/worker", "active/manager"]
9778+
description: |
9779+
Contains information about Swarm status of the daemon,
9780+
and if the daemon is acting as a manager or worker node.
9781+
default: "inactive"
9782+
Cache-Control:
9783+
type: "string"
9784+
default: "no-cache, no-store, must-revalidate"
9785+
Pragma:
9786+
type: "string"
9787+
default: "no-cache"
9788+
500:
9789+
description: "server error"
9790+
schema:
9791+
$ref: "#/definitions/ErrorResponse"
9792+
headers:
9793+
Cache-Control:
9794+
type: "string"
9795+
default: "no-cache, no-store, must-revalidate"
9796+
Pragma:
9797+
type: "string"
9798+
default: "no-cache"
9799+
tags: ["System"]
97129800
/commit:
97139801
post:
97149802
summary: "Create a new image from a container"

docs/api/version-history.md

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ keywords: "API, Docker, rcli, REST, documentation"
5858
the one that sorts first is picked.
5959
* `GET /containers/json` now returns a `GwPriority` field in `NetworkSettings`
6060
for each network endpoint.
61+
* `GET` `/_ping` endpoint now supports a `capabilities` query parameter (currently only
62+
takes a constant `v1`, e.g. `GET /_ping?capabilities=v1`). If set, instead of the
63+
response body containing `OK`, the daemon responds with with a json representation
64+
of the engine's capabilites (`system.Capabilities`).
6165

6266
## v1.47 API changes
6367

0 commit comments

Comments
 (0)