Fokko commented on code in PR #11806: URL: https://github.com/apache/iceberg/pull/11806#discussion_r1912770377
########## 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: For the Jersey one, it is the other way around, it will generate an `ActionEnum` per `Update`: ```java public enum ActionEnum { ADD_SPEC(String.valueOf("add-spec")); private String value; ActionEnum(String value) { this.value = value; } @JsonValue public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } @JsonCreator public static ActionEnum fromValue(String value) { for (ActionEnum b : ActionEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } ``` -- 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