You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/06/01 08:18:36 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #7710: Open-API: Refactor TableRequirements

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


##########
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:

Review Comment:
   ```suggestion
           last-assigned-field-id:
   ```



##########
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

Review Comment:
   ```suggestion
           - last-assigned-field-id
   ```



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org