Fokko commented on code in PR #11806: URL: https://github.com/apache/iceberg/pull/11806#discussion_r1912746161
########## open-api/rest-catalog-open-api.py: ########## @@ -267,26 +267,57 @@ class ViewVersion(BaseModel): default_namespace: Namespace = Field(..., alias='default-namespace') +class ContentEnum(BaseModel): + __root__: Literal['data', 'equality-deletes', 'position-deletes'] + + +class ActionEnum(BaseModel): + __root__: Literal[ + 'add-spec', + 'add-schema', + 'add-snapshot', + 'add-sort-order', + 'add-view-version', + 'assign-uuid', + 'remove-partition-specs', + 'remove-partition-statistics', + 'remove-properties', + 'remove-snapshot-ref', + 'remove-snapshots', + 'remove-statistics', + 'set-current-schema', + 'set-current-view-version', + 'set-default-sort-order', + 'set-default-spec', + 'set-location', + 'set-partition-statistics', + 'set-properties', + 'set-snapshot-ref', + 'set-statistics', + 'upgrade-format-version', + ] + + class BaseUpdate(BaseModel): - action: str + action: ActionEnum class AssignUUIDUpdate(BaseUpdate): """ Assigning a UUID to a table/view should only be done when creating the table/view. It is not safe to re-assign the UUID if a table/view already has a UUID assigned """ - action: Literal['assign-uuid'] + action: ActionEnum uuid: str class UpgradeFormatVersionUpdate(BaseUpdate): - action: Literal['upgrade-format-version'] + action: ActionEnum Review Comment: From a Pydantics' perspective this has a different semantic meaning. Before, we required that the `action` field for the `UpgradeFormatVersionUpdate` needs to be `upgrade-format-version`, now it can be any value from the enum. But, this can also be a limitation of the Pydantic open-api generator. Let me take a deeper look. -- 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