Fokko commented on code in PR #11806: URL: https://github.com/apache/iceberg/pull/11806#discussion_r1913028292
########## 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: @VladimirYushkevich @ajantha-bhat I've been playing around with alternative solutions. In Open-API there are many ways to get to the same result. What about https://github.com/apache/iceberg/pull/11955? The issue is related to the Enum, and with Open-API 3.1 the `const` is added looks more appropriate here. LMKWYT -- 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