Fokko commented on code in PR #10434: URL: https://github.com/apache/iceberg/pull/10434#discussion_r1626572332
########## open-api/rest-catalog-open-api.py: ########## @@ -361,23 +361,29 @@ class RemovePartitionStatisticsUpdate(BaseUpdate): class TableRequirement(BaseModel): - type: str + type: Literal[ + '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', + ] class AssertCreate(TableRequirement): """ The table must not already exist; used for create transactions """ - type: Literal['assert-create'] Review Comment: It makes sense, for example: ```python class AssertTableUUID(TableRequirement): """ The table UUID must match the requirement's `uuid` """ type: Literal['assert-table-uuid'] uuid: str ``` When this class is converted to JSON using Pydantic, it will result in: ```json { "type": "assert-create", "uuid": "550e8400-e29b-41d4-a716-446655440000" } ``` I think I prefer the union as well. -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org