Skip to content

Add a v1.57 module (OpenAPI 3.2 spec) - #672

Draft
gesellix wants to merge 7 commits into
mainfrom
api-v1.57
Draft

gesellix wants to merge 7 commits into
mainfrom
api-v1.57

Conversation

@gesellix

Copy link
Copy Markdown
Contributor

Docker Engine 29.10.0 ships API v1.57 and moves the Engine API specification to OpenAPI 3.2 (release notes, moby/moby#53630). This adds an api-model-v1-57 module generated from that new source of truth.

Commits

  1. Upstream spec: unmodified api/openapi.yaml from moby at tag api/v1.57.0.
  2. Declared as OpenAPI 3.1: openapi-generator (7.27.0, and 7.28.0 as latest) can't parse 3.2 and falls back to the Swagger 1.x/2.0 parsers. The spec uses no 3.2-only constructs and validates cleanly as 3.1.
  3. Local model fixes: the v1.52 adjustments (nullability, required fields, enum var names) ported to the components/schemas layout. New for v1.57:
    • enum: [{}] is commented out for ExposedPorts/Volumes. Otherwise the 3.1 parse path generates a single-value enum instead of Map<String, Any>.
    • [aliases...] is changed back to [aliases], because ktlint fails to parse the original in KDoc.
  4. The module: build config and generated sources.
  5. No client-side defaults: a local override of data_class_opt_var.mustache makes optional properties default to null.
    • The spec defaults describe what the daemon does for omitted fields. Sending them explicitly is not always the same. For example, AttachStdout/AttachStderr default to true in the spec, while the daemon treats omitted fields as false. An explicit StopSignal: "SIGTERM" overrides an image's STOPSIGNAL.
    • This matches moby's Go client, which sends zero values or omits fields.
    • Required properties keep their defaults.
  6. Tests: the field-count tests from v1.52, plus OmittedDefaultsTest. The same round trip through the v1.52 model turns {"Image":"alpine"} into {"AttachStdin":false,"AttachStdout":true,"AttachStderr":true,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Image":"alpine","StopSignal":"SIGTERM"}.
  7. Swagger 2.0 variant as documentation: api/swagger.yaml from the same tag, not used by the build.
    • We follow the source of truth (OpenAPI 3.x) even with local modifications.
    • Generated from the unpatched specs, the two parse paths differ in only 12 properties.

Upstream status of OpenAPI 3.2 support

All of these are open and have no maintainer review yet:

Once 3.2 is supported, the 3.1 declaration (commit 2) can be dropped.

Notes

  • Older modules: v1-41 to v1-52 still generate the spec defaults, and this PR doesn't change them.
  • Existing users: consumers that move to the v1-57 model lose those implicit defaults. Where docker-client acts like docker run, it should set AttachStdout/AttachStderr explicitly, as docker/cli does.
  • Upgrade work in progress: docker-remote-api-client and docker-client are currently on the 1-44 model. Their upgrade to 1-52 is prepared on local branches.

🤖 Generated with Claude Code

gesellix and others added 7 commits November 30, 2026 22:18
Unmodified copy of api/openapi.yaml from moby/moby at tag api/v1.57.0.
Docker Engine 29.10.0 moved the API specification to OpenAPI 3.2:
https://docs.docker.com/engine/release-notes/29/#-engine-api-specification-moves-to-openapi-32

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
openapi-generator (7.27.0, and 7.28.0 as the latest release) does not
recognize "openapi: 3.2.0" and falls back to the Swagger 1.x/2.0 parsers,
which fail with thousands of errors.

The spec uses no 3.2-only constructs (itemSchema, $self, querystring
parameters, additionalOperations, tag parent/kind, ...), and it validates
without errors when declared as 3.1.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the local adjustments of the v1.52 spec (see 275c8e5), adapted to the
OpenAPI 3.x layout (components/schemas):
- nullability and required fields (Health, HealthcheckResult, ContainerConfig,
  DriverData, ImageInspect, ImageSummary, Volume, ContainerState,
  ContainerCreateResponse, ImageHistoryResponseItem.Tags)
- x-enum-varnames for ChangeType and SystemInfo.CgroupVersion
- StopSignal default "SIGTERM"

ContainerConfig.StopTimeout keeps the upstream definition, because upstream
removed its default (the daemon-wide default-stop-timeout applies).

New for v1.57:
- Comment out "enum: [{}]" in the additionalProperties of ExposedPorts and
  Volumes. With the OpenAPI 3.1 parser, openapi-generator turns them into a
  single-value enum instead of Map<String, Any>.
- Use "[aliases]" instead of "[aliases...]" in the hosts description, which
  ktlint fails to parse as KDoc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated with openapi-generator 7.27.0 from the OpenAPI 3.1-declared spec
(./gradlew :api-model-v1-57:updateApiModelSources
openApiGenerateCleanupGeneratedCode, then ktlintFormat).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spec's default values describe what the daemon does when a field is
omitted. Generating them as Kotlin defaults makes the client send them
explicitly, which is not always the same as omitting them. For example,
ContainerConfig.AttachStdout/AttachStderr default to true in the spec, while
the daemon treats an omitted field as false, and an explicit StopSignal
"SIGTERM" overrides an image's STOPSIGNAL. Deserialized responses would also
pretend to have values the daemon didn't send.

Override the kotlin data_class_opt_var.mustache template, so that optional
properties always default to null. Required properties keep their defaults.

Also drop the StopSignal default "SIGTERM" that was carried over from the
v1.52 spec adjustments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy the ContainerCreateRequest/ContainerUpdateRequest field-count tests from
v1.52, and add OmittedDefaultsTest: minimal requests must survive a Moshi
round trip without gaining default values, and absent response fields must
stay null.

The same round trip through the v1.52 model turns {"Image":"alpine"} into
{"AttachStdin":false,"AttachStdout":true,"AttachStderr":true,"Tty":false,
"OpenStdin":false,"StdinOnce":false,"Image":"alpine","StopSignal":"SIGTERM"}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unmodified copy of api/swagger.yaml from moby/moby at tag api/v1.57.0
(identical to api/docs/v1.57-swagger.yaml there). It is not used by the
build, which keeps generating from docker-engine-api-v1.57.yaml.

Since moby/moby#53630, api/openapi.yaml (OpenAPI 3.2) is the source of truth
of the Engine API. moby derives swagger.yaml from it for existing tooling,
e.g. their go-swagger code generation, and only api/v1.57 gets an additional
per-version Swagger 2.0 copy.

We follow the source of truth, even if we have to modify it:
openapi-generator (7.28.0) cannot parse OpenAPI 3.2, because swagger-parser
and swagger-core don't support it yet (swagger-api/swagger-parser#2248,
swagger-api/swagger-parser#2401, swagger-api/swagger-core#5326 and
OpenAPITools/openapi-generator#25484 are open). Hence the 3.1 declaration and
the local model fixes in docker-engine-api-v1.57.yaml.

The Swagger 2.0 variant helps to compare both parse paths. Generated from the
unpatched specs (same config and templates), the models differ in 12
properties only:
- swagger.yaml keeps ExposedPorts/Volumes as Map<String, Any>, while the 3.1
  path needs the "enum: [{}]" workaround.
- The 3.1 path types ContainerStatsResponse.Networks as
  Map<String, ContainerNetworkStats?> instead of Any, and uses Any? instead of
  Any for untyped items (*DiskUsage.Items, NetworkInspect.Services).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

27 files  +21  27 suites  +21   1s ⏱️ -1s
 8 tests + 6   8 ✅ + 6  0 💤 ±0  0 ❌ ±0 
42 runs  +36  42 ✅ +36  0 💤 ±0  0 ❌ ±0 

Results for commit 4076406. ± Comparison against base commit 366c48c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant