Fokko commented on code in PR #7710:
URL: https://github.com/apache/iceberg/pull/7710#discussion_r1216646858


##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -1649,58 +1649,134 @@ components:
         - $ref: '#/components/schemas/SetPropertiesUpdate'
         - $ref: '#/components/schemas/RemovePropertiesUpdate'
 
-    TableRequirement:
-      description:
-        Assertions from the client that must be valid for the commit to 
succeed. Assertions are identified by `type` -
-
-        - `assert-create` - the table must not already exist; used for create 
transactions
-
-        - `assert-table-uuid` - the table UUID must match the requirement's 
`uuid`
-
-        - `assert-ref-snapshot-id` - the table branch or tag identified by the 
requirement's `ref` must reference the requirement's `snapshot-id`; if 
`snapshot-id` is `null` or missing, the ref must not already exist
-
-        - `assert-last-assigned-field-id` - the table's last assigned column 
id must match the requirement's `last-assigned-field-id`
-
-        - `assert-current-schema-id` - the table's current schema id must 
match the requirement's `current-schema-id`
-
-        - `assert-last-assigned-partition-id` - the table's last assigned 
partition id must match the requirement's `last-assigned-partition-id`
-
-        - `assert-default-spec-id` - the table's default spec id must match 
the requirement's `default-spec-id`
-
-        - `assert-default-sort-order-id` - the table's default sort order id 
must match the requirement's `default-sort-order-id`
+    AssertCreate:
       type: object
+      description: The table must not already exist; used for create 
transactions
       required:
         - type
       properties:
         type:
           type: string
-          enum:
-            - assert-create
-            - assert-table-uuid
-            - assert-ref-snapshot-id
-            - assert-last-assigned-field-id
-            - assert-current-schema-id
-            - assert-last-assigned-partition-id
-            - assert-default-spec-id
-            - assert-default-sort-order-id
-        ref:
+          enum: ["assert-create"]
+
+    AssertTableUUID:
+      description: The table UUID must match the requirement's `uuid`
+      required:
+        - type
+        - uuid
+      properties:
+        type:
           type: string
+          enum: ["assert-table-uuid"]
         uuid:
           type: string
+
+    AssertRefSnapshotId:
+      description:
+        The table branch or tag identified by the requirement's `ref` must 
reference the requirement's `snapshot-id`; 
+        if `snapshot-id` is `null` or missing, the ref must not already exist
+      required:
+        - type
+        - ref
+        - snapshot-id
+      properties:
+        type:
+          type: string
+          enum: [ "assert-ref-snapshot-id" ]
+        ref:
+          type: string
         snapshot-id:
           type: integer
           format: int64
-        last-assigned-field-id:
+
+    AssertLastAssignedFieldId:
+      description:
+        The table's last assigned column id must match the requirement's 
`last-assigned-field-id`
+      required:
+        - type
+        - last-assigned-partition-id
+      properties:
+        type:
+          type: string
+          enum: [ "assert-last-assigned-field-id" ]
+        last-assigned-partition-id:
           type: integer
+
+    AssertCurrentSchemaId:
+      description:
+        The table's current schema id must match the requirement's 
`current-schema-id`
+      required:
+        - type
+        - current-schema-id
+      properties:
+        type:
+          type: string
+          enum: [ "assert-current-schema-id" ]
         current-schema-id:
           type: integer
+
+    AssertLastAssignedPartitionId:
+      description:
+        The table's last assigned partition id must match the requirement's 
`last-assigned-partition-id`
+      required:
+        - type
+        - last-assigned-partition-id
+      properties:
+        type:
+          type: string
+          enum: [ "assert-last-assigned-partition-id" ]
         last-assigned-partition-id:
           type: integer
+
+    AssertDefaultSpecId:
+      description:
+        The table's default spec id must match the requirement's 
`default-spec-id`
+      required:
+        - type
+        - default-spec-id
+      properties:
+        type:
+          type: string
+          enum: [ "assert-default-spec-id" ]
         default-spec-id:
           type: integer
+
+    AssertDefaultSortOrderId:
+      description:
+        The table's default sort order id must match the requirement's 
`default-sort-order-id`
+      required:
+        - type
+        - default-sort-order-id
+      properties:
+        type:
+          type: string
+          enum: [ "assert-default-sort-order-id" ]
         default-sort-order-id:
           type: integer
 
+    TableRequirement:
+      oneOf:

Review Comment:
   I don't think the `ReportMetricsRequest` metric is correct.
   
   ```yaml
       ReportMetricsRequest:
         anyOf:
           - $ref: '#/components/schemas/ScanReport'
           - $ref: '#/components/schemas/CommitReport'
         required:
           - report-type
         properties:
           report-type:
             type: string
   ```
   
   Let's take the `report-type`. Which value corresponds to the `ScanReport` or 
`CommitReport`? This is `scan-report` and `commit-report`, but this is not 
described in the spec. If you would generate code from it, and you have a class 
that accepts a `ReportMetricRequests`:
   
   ```yaml
       post:
         tags:
           - Catalog API
         summary: Send a metrics report to this endpoint to be processed by the 
backend
         operationId: reportMetrics
         requestBody:
           description: The request containing the metrics report to be sent
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/ReportMetricsRequest'
   ```
   
   It cannot determine if is a `ScanReport` or `CommitReport`, this is where 
you need the discriminator.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to