This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new e7834d8b56a [FLINK-27818][rest][docs] Model enums as references
e7834d8b56a is described below

commit e7834d8b56a7b4b1c2674ab399032e21e76d9e63
Author: Chesnay Schepler <[email protected]>
AuthorDate: Fri May 27 14:36:47 2022 +0200

    [FLINK-27818][rest][docs] Model enums as references
---
 docs/static/generated/rest_v1_dispatcher.yml       | 279 +++++++++------------
 .../flink/docs/rest/OpenApiSpecGenerator.java      |   1 +
 2 files changed, 125 insertions(+), 155 deletions(-)

diff --git a/docs/static/generated/rest_v1_dispatcher.yml 
b/docs/static/generated/rest_v1_dispatcher.yml
index 9f2faead459..ff9e74a0150 100644
--- a/docs/static/generated/rest_v1_dispatcher.yml
+++ b/docs/static/generated/rest_v1_dispatcher.yml
@@ -405,12 +405,7 @@ paths:
         required: false
         style: form
         schema:
-          type: string
-          enum:
-          - MIN
-          - MAX
-          - SUM
-          - AVG
+          $ref: '#/components/schemas/AggregationMode'
       - name: jobs
         in: query
         description: Comma-separated list of 32-character hexadecimal strings 
to select
@@ -469,10 +464,7 @@ paths:
         required: false
         style: form
         schema:
-          type: string
-          enum:
-          - CANCEL
-          - STOP
+          $ref: '#/components/schemas/TerminationMode'
       responses:
         "202":
           description: The request was successful.
@@ -932,11 +924,7 @@ paths:
         required: false
         style: form
         schema:
-          type: string
-          enum:
-          - FULL
-          - ON_CPU
-          - OFF_CPU
+          $ref: '#/components/schemas/Type'
       responses:
         "200":
           description: The request was successful.
@@ -1027,12 +1015,7 @@ paths:
         required: false
         style: form
         schema:
-          type: string
-          enum:
-          - MIN
-          - MAX
-          - SUM
-          - AVG
+          $ref: '#/components/schemas/AggregationMode'
       - name: subtasks
         in: query
         description: "Comma-separated list of integer ranges (e.g. 
\"1,3,5-9\") to\
@@ -1333,12 +1316,7 @@ paths:
         required: false
         style: form
         schema:
-          type: string
-          enum:
-          - MIN
-          - MAX
-          - SUM
-          - AVG
+          $ref: '#/components/schemas/AggregationMode'
       - name: taskmanagers
         in: query
         description: Comma-separated list of 32-character hexadecimal strings 
to select
@@ -1459,6 +1437,13 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/Node'
+    AggregationMode:
+      type: string
+      enum:
+      - MIN
+      - MAX
+      - SUM
+      - AVG
     CheckpointAlignment:
       type: object
       properties:
@@ -1581,19 +1566,7 @@ components:
         isStoppable:
           type: boolean
         state:
-          type: string
-          enum:
-          - INITIALIZING
-          - CREATED
-          - RUNNING
-          - FAILING
-          - FAILED
-          - CANCELLING
-          - CANCELED
-          - FINISHED
-          - RESTARTING
-          - SUSPENDED
-          - RECONCILING
+          $ref: '#/components/schemas/JobStatus'
         start-time:
           type: integer
           format: int64
@@ -1648,6 +1621,11 @@ components:
           format: int64
         write-records-complete:
           type: boolean
+    SavepointFormatType:
+      type: string
+      enum:
+      - CANONICAL
+      - NATIVE
     SerializedThrowable:
       type: object
       properties:
@@ -1661,6 +1639,12 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/TaskManagerInfo'
+    RestoreMode:
+      type: string
+      enum:
+      - CLAIM
+      - NO_CLAIM
+      - LEGACY
     SubtaskExecutionAttemptDetailsInfo:
       type: object
       properties:
@@ -1668,18 +1652,7 @@ components:
           type: integer
           format: int32
         status:
-          type: string
-          enum:
-          - CREATED
-          - SCHEDULED
-          - DEPLOYING
-          - RUNNING
-          - FINISHED
-          - CANCELING
-          - CANCELED
-          - FAILED
-          - RECONCILING
-          - INITIALIZING
+          $ref: '#/components/schemas/ExecutionState'
         attempt:
           type: integer
           format: int32
@@ -1704,12 +1677,7 @@ components:
         jobId:
           $ref: '#/components/schemas/JobID'
         applicationStatus:
-          type: string
-          enum:
-          - SUCCEEDED
-          - FAILED
-          - CANCELED
-          - UNKNOWN
+          $ref: '#/components/schemas/ApplicationStatus'
         accumulatorResults:
           type: object
           additionalProperties:
@@ -1769,10 +1737,7 @@ components:
         cancel-job:
           type: boolean
         formatType:
-          type: string
-          enum:
-          - CANONICAL
-          - NATIVE
+          $ref: '#/components/schemas/SavepointFormatType'
         triggerId:
           $ref: '#/components/schemas/TriggerId'
     ThreadDumpInfo:
@@ -1826,11 +1791,7 @@ components:
           type: integer
           format: int64
         status:
-          type: string
-          enum:
-          - IN_PROGRESS
-          - COMPLETED
-          - FAILED
+          $ref: '#/components/schemas/CheckpointStatsStatus'
         latest_ack_timestamp:
           type: integer
           format: int64
@@ -1862,21 +1823,14 @@ components:
       type: object
       properties:
         status:
-          type: string
-          enum:
-          - INITIALIZING
-          - CREATED
-          - RUNNING
-          - FAILING
-          - FAILED
-          - CANCELLING
-          - CANCELED
-          - FINISHED
-          - RESTARTING
-          - SUSPENDED
-          - RECONCILING
+          $ref: '#/components/schemas/JobStatus'
     JobAccumulator:
       type: object
+    Id:
+      type: string
+      enum:
+      - IN_PROGRESS
+      - COMPLETED
     JobID:
       pattern: "[0-9a-f]{32}"
       type: string
@@ -1889,11 +1843,7 @@ components:
           type: integer
           format: int64
         status:
-          type: string
-          enum:
-          - IN_PROGRESS
-          - COMPLETED
-          - FAILED
+          $ref: '#/components/schemas/CheckpointStatsStatus'
         is_savepoint:
           type: boolean
         trigger_timestamp:
@@ -1927,11 +1877,7 @@ components:
           type: integer
           format: int32
         checkpoint_type:
-          type: string
-          enum:
-          - CHECKPOINT
-          - SAVEPOINT
-          - SYNC_SAVEPOINT
+          $ref: '#/components/schemas/RestAPICheckpointType'
         tasks:
           type: object
           additionalProperties:
@@ -1986,6 +1932,20 @@ components:
           type: string
     AggregatedMetricsResponseBody:
       type: object
+    JobStatus:
+      type: string
+      enum:
+      - INITIALIZING
+      - CREATED
+      - RUNNING
+      - FAILING
+      - FAILED
+      - CANCELLING
+      - CANCELED
+      - FINISHED
+      - RESTARTING
+      - SUSPENDED
+      - RECONCILING
     SubtasksAllAccumulatorsInfo:
       type: object
       properties:
@@ -2008,6 +1968,10 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/ClusterDataSetEntry'
+    UploadStatus:
+      type: string
+      enum:
+      - success
     SavepointDisposalRequest:
       type: object
       properties:
@@ -2059,11 +2023,7 @@ components:
         savepointPath:
           type: string
         restoreMode:
-          type: string
-          enum:
-          - CLAIM
-          - NO_CLAIM
-          - LEGACY
+          $ref: '#/components/schemas/RestoreMode'
     SubtaskAccumulatorsInfo:
       type: object
       properties:
@@ -2137,6 +2097,12 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/UserAccumulator'
+    Type:
+      type: string
+      enum:
+      - FULL
+      - ON_CPU
+      - OFF_CPU
     ClusterConfigurationInfo:
       type: array
       properties:
@@ -2153,6 +2119,12 @@ components:
           type: string
         value:
           type: string
+    VertexBackPressureLevel:
+      type: string
+      enum:
+      - ok
+      - low
+      - high
     CheckpointDuration:
       type: object
       properties:
@@ -2190,6 +2162,11 @@ components:
           type: string
       discriminator:
         propertyName: className
+    TerminationMode:
+      type: string
+      enum:
+      - CANCEL
+      - STOP
     CompletedSubtaskCheckpointStatistics:
       type: object
       allOf:
@@ -2223,6 +2200,24 @@ components:
       type: object
       allOf:
       - $ref: '#/components/schemas/CheckpointStatistics'
+    ExecutionState:
+      type: string
+      enum:
+      - CREATED
+      - SCHEDULED
+      - DEPLOYING
+      - RUNNING
+      - FINISHED
+      - CANCELING
+      - CANCELED
+      - FAILED
+      - RECONCILING
+      - INITIALIZING
+    ProcessingMode:
+      type: string
+      enum:
+      - AT_LEAST_ONCE
+      - EXACTLY_ONCE
     JobSubmitResponseBody:
       type: object
       properties:
@@ -2262,6 +2257,23 @@ components:
           additionalProperties:
             type: integer
             format: int64
+    CheckpointStatsStatus:
+      type: string
+      enum:
+      - IN_PROGRESS
+      - COMPLETED
+      - FAILED
+    RestAPICheckpointType:
+      type: string
+      enum:
+      - CHECKPOINT
+      - SAVEPOINT
+      - SYNC_SAVEPOINT
+    VertexBackPressureStatus:
+      type: string
+      enum:
+      - deprecated
+      - ok
     ExternalizedCheckpointInfo:
       type: object
       properties:
@@ -2303,16 +2315,9 @@ components:
       type: object
       properties:
         status:
-          type: string
-          enum:
-          - deprecated
-          - ok
+          $ref: '#/components/schemas/VertexBackPressureStatus'
         backpressure-level:
-          type: string
-          enum:
-          - ok
-          - low
-          - high
+          $ref: '#/components/schemas/VertexBackPressureLevel'
         end-timestamp:
           type: integer
           format: int64
@@ -2326,19 +2331,7 @@ components:
         id:
           $ref: '#/components/schemas/JobID'
         status:
-          type: string
-          enum:
-          - INITIALIZING
-          - CREATED
-          - RUNNING
-          - FAILING
-          - FAILED
-          - CANCELLING
-          - CANCELED
-          - FINISHED
-          - RESTARTING
-          - SUSPENDED
-          - RECONCILING
+          $ref: '#/components/schemas/JobStatus'
     ClusterConfigurationInfoEntry:
       type: object
       properties:
@@ -2352,10 +2345,7 @@ components:
       type: object
       properties:
         id:
-          type: string
-          enum:
-          - IN_PROGRESS
-          - COMPLETED
+          $ref: '#/components/schemas/Id'
     LatestCheckpoints:
       type: object
       properties:
@@ -2417,10 +2407,7 @@ components:
         drain:
           type: boolean
         formatType:
-          type: string
-          enum:
-          - CANONICAL
-          - NATIVE
+          $ref: '#/components/schemas/SavepointFormatType'
         triggerId:
           $ref: '#/components/schemas/TriggerId'
     DashboardConfiguration:
@@ -2604,19 +2591,7 @@ components:
           type: integer
           format: int64
         status:
-          type: string
-          enum:
-          - INITIALIZING
-          - CREATED
-          - RUNNING
-          - FAILING
-          - FAILED
-          - CANCELLING
-          - CANCELED
-          - FINISHED
-          - RESTARTING
-          - SUSPENDED
-          - RECONCILING
+          $ref: '#/components/schemas/JobStatus'
         lastUpdateTime:
           type: integer
           format: int64
@@ -2649,11 +2624,7 @@ components:
           type: integer
           format: int64
         status:
-          type: string
-          enum:
-          - IN_PROGRESS
-          - COMPLETED
-          - FAILED
+          $ref: '#/components/schemas/CheckpointStatsStatus'
         latest_ack_timestamp:
           type: integer
           format: int64
@@ -2712,10 +2683,7 @@ components:
       type: object
       properties:
         mode:
-          type: string
-          enum:
-          - AT_LEAST_ONCE
-          - EXACTLY_ONCE
+          $ref: '#/components/schemas/ProcessingMode'
         interval:
           type: integer
           format: int64
@@ -2806,9 +2774,7 @@ components:
         filename:
           type: string
         status:
-          type: string
-          enum:
-          - success
+          $ref: '#/components/schemas/UploadStatus'
     RawJson:
       type: object
     SerializedValueOptionalFailureObject:
@@ -2876,6 +2842,13 @@ components:
           $ref: '#/components/schemas/HardwareDescription'
         memoryConfiguration:
           $ref: '#/components/schemas/TaskExecutorMemoryConfiguration'
+    ApplicationStatus:
+      type: string
+      enum:
+      - SUCCEEDED
+      - FAILED
+      - CANCELED
+      - UNKNOWN
     Summary:
       type: object
       properties:
@@ -2922,11 +2895,7 @@ components:
           type: integer
           format: int32
         backpressure-level:
-          type: string
-          enum:
-          - ok
-          - low
-          - high
+          $ref: '#/components/schemas/VertexBackPressureLevel'
         ratio:
           type: number
           format: double
diff --git 
a/flink-docs/src/main/java/org/apache/flink/docs/rest/OpenApiSpecGenerator.java 
b/flink-docs/src/main/java/org/apache/flink/docs/rest/OpenApiSpecGenerator.java
index c147dc306bb..59bd3a673cb 100644
--- 
a/flink-docs/src/main/java/org/apache/flink/docs/rest/OpenApiSpecGenerator.java
+++ 
b/flink-docs/src/main/java/org/apache/flink/docs/rest/OpenApiSpecGenerator.java
@@ -96,6 +96,7 @@ public class OpenApiSpecGenerator {
     private static final ModelConverterContext modelConverterContext;
 
     static {
+        ModelResolver.enumsAsRef = true;
         final ObjectMapper mapper =
                 new 
ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
         modelConverterContext =

Reply via email to