Skip to content

Commit

Permalink
[FLINK-33352][rest][docs] Add schema mappings to discriminator proper…
Browse files Browse the repository at this point in the history
…ties
  • Loading branch information
zentol committed Oct 25, 2023
1 parent e9bf7b5 commit 100cc20
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/static/generated/rest_v1_dispatcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,10 @@ components:
format: int64
discriminator:
propertyName: className
mapping:
completed: '#/components/schemas/CompletedCheckpointStatistics'
failed: '#/components/schemas/FailedCheckpointStatistics'
in_progress: '#/components/schemas/PendingCheckpointStatistics'
CheckpointStatisticsSummary:
type: object
properties:
Expand Down Expand Up @@ -2935,6 +2939,9 @@ components:
type: string
discriminator:
propertyName: className
mapping:
completed: '#/components/schemas/CompletedSubtaskCheckpointStatistics'
pending: '#/components/schemas/PendingSubtaskCheckpointStatistics'
SubtaskExecutionAttemptAccumulatorsInfo:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.annotation.JsonSerialize;

import io.swagger.v3.oas.annotations.media.DiscriminatorMapping;
import io.swagger.v3.oas.annotations.media.Schema;

import javax.annotation.Nullable;

import java.util.Collection;
Expand All @@ -64,6 +67,19 @@
value = CheckpointStatistics.PendingCheckpointStatistics.class,
name = "in_progress")
})
@Schema(
discriminatorProperty = "className",
discriminatorMapping = {
@DiscriminatorMapping(
value = "completed",
schema = CheckpointStatistics.CompletedCheckpointStatistics.class),
@DiscriminatorMapping(
value = "failed",
schema = CheckpointStatistics.FailedCheckpointStatistics.class),
@DiscriminatorMapping(
value = "in_progress",
schema = CheckpointStatistics.PendingCheckpointStatistics.class),
})
public class CheckpointStatistics implements ResponseBody {

public static final String FIELD_NAME_ID = "id";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonSubTypes;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeInfo;

import io.swagger.v3.oas.annotations.media.DiscriminatorMapping;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.Objects;

/** Checkpoint statistics for a subtask. */
Expand All @@ -38,6 +41,17 @@
value = SubtaskCheckpointStatistics.PendingSubtaskCheckpointStatistics.class,
name = "pending")
})
@Schema(
discriminatorProperty = "className",
discriminatorMapping = {
@DiscriminatorMapping(
value = "completed",
schema =
SubtaskCheckpointStatistics.CompletedSubtaskCheckpointStatistics.class),
@DiscriminatorMapping(
value = "pending",
schema = SubtaskCheckpointStatistics.PendingSubtaskCheckpointStatistics.class),
})
public class SubtaskCheckpointStatistics {

public static final String FIELD_NAME_INDEX = "index";
Expand Down

0 comments on commit 100cc20

Please sign in to comment.