Skip to content

[hotfix][docs] Fix OpenAPI spec for SlotSharingGroupId, MetricCollectionResponseBody, and SerializedThrowable custom serializers#27903

Open
nikhilsu wants to merge 5 commits intoapache:masterfrom
nikhilsu:fix-slotsharinggroupid-openapi-schema
Open

[hotfix][docs] Fix OpenAPI spec for SlotSharingGroupId, MetricCollectionResponseBody, and SerializedThrowable custom serializers#27903
nikhilsu wants to merge 5 commits intoapache:masterfrom
nikhilsu:fix-slotsharinggroupid-openapi-schema

Conversation

@nikhilsu
Copy link
Copy Markdown

@nikhilsu nikhilsu commented Apr 8, 2026

What is the purpose of the change

This PR fixes three Flink request/response DTOs that use custom Jackson serializers, while their OpenAPI specs are generated from the DTO schema. This leads to a mismatch between the actual wire format and what the generated spec describes and breaking downstream clients:

  1. SlotSharingGroupId: Serialized as a hex string by SlotSharingGroupIDSerializer (added in FLINK-20090), but the spec incorrectly defines it as an object with bytes, lowerPart, upperPart fields becauseoverrideIdSchemas() does not include SlotSharingGroupId.

  2. MetricCollectionResponseBody: Serialized as a raw JSON array [{"id": "metricName", "value": "1"}] by a custom Serializer (annotated with @JsonSerialize), but the spec incorrectly defines it as an object with a metrics property.

  3. SerializedThrowable: Serialized with three fields (class, stack-trace, serialized-throwable) by SerializedThrowableSerializer, but the spec override only included serialized-throwable, omitting the classandstack-trace` string fields.

None of these changes break backward compatibility - the previous schemas never matched the actual wire format, so any client generated from the spec would have already failed to decode these fields correctly.

Affected endpoints:

  • GET /jobs/:jobid (SlotSharingGroupId in JobDetailsInfo.JobVertexDetailsInfo)
  • GET /jobmanager/metrics
  • GET /jobs/:jobid/metrics
  • GET /jobs/:jobid/vertices/:vertexid/metrics
  • GET /jobs/:jobid/vertices/:vertexid/subtasks/metrics
  • GET /jobs/:jobid/vertices/:vertexid/watermarks
  • GET /taskmanagers/:taskmanagerid/metrics
  • GET /taskmanagers/metrics
  • Any endpoint returning SerializedThrowable (savepoint/checkpoint failure responses)

Brief change log

  • Added SlotSharingGroupId to OpenApiSpecGenerator.overrideIdSchemas() to generate type: string with pattern [0-9a-f]{32}
  • Added overrideMetricCollectionSchema() to replace the MetricCollectionResponseBody object schema with an array schema referencing Metric
  • Updated overrideSerializeThrowableSchema() to include class and stack-trace string fields alongside the existing serialized-throwable binary field
  • Made FIELD_NAME_CLASS and FIELD_NAME_STACK_TRACE in SerializedThrowableSerializer public so they can be referenced from OpenApiSpecGenerator

Verifying this change

This change is already covered by existing tests, such as OpenApiSpecGeneratorTest.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no (only visibility change on constants, no behavior change)
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@nikhilsu nikhilsu marked this pull request as ready for review April 8, 2026 07:59
@flinkbot
Copy link
Copy Markdown
Collaborator

flinkbot commented Apr 8, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@nikhilsu
Copy link
Copy Markdown
Author

nikhilsu commented Apr 8, 2026

cc: @zentol @gaborgsomogyi

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: changes to *.yml were made as part of running ./mvnw package -Dgenerate-rest-docs -pl flink-docs -am -nsu -DskipTests 2>&1

@github-actions github-actions bot added the community-reviewed PR has been reviewed by the community. label Apr 8, 2026
@nikhilsu nikhilsu changed the title [hotfix][docs] Add SlotSharingGroupId to OpenAPI spec generator ID schema overrides [hotfix][docs] Fix OpenAPI spec for SlotSharingGroupId and MetricCollectionResponseBody custom serializers Apr 8, 2026
@nikhilsu nikhilsu force-pushed the fix-slotsharinggroupid-openapi-schema branch from a89e2bd to 6b7ff1e Compare April 8, 2026 20:58
@nikhilsu nikhilsu changed the title [hotfix][docs] Fix OpenAPI spec for SlotSharingGroupId and MetricCollectionResponseBody custom serializers [hotfix][docs] Fix OpenAPI spec for SlotSharingGroupId, MetricCollectionResponseBody, and SerializedThrowable custom serializers Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants