jerryshao commented on code in PR #7133:
URL: https://github.com/apache/gravitino/pull/7133#discussion_r2083732578


##########
common/src/main/java/org/apache/gravitino/dto/requests/ModelVersionUpdateRequest.java:
##########
@@ -167,4 +170,36 @@ public void validate() throws IllegalArgumentException {
           StringUtils.isNotBlank(newUri), "\"newUri\" field is required and 
cannot be empty");
     }
   }
+
+  /** Request to update the aliases of a model version. */
+  @EqualsAndHashCode
+  @AllArgsConstructor
+  @NoArgsConstructor(force = true)
+  @ToString
+  @Getter
+  class UpdateModelVersionAliasesRequest implements ModelVersionUpdateRequest {
+    @JsonProperty("aliasesToAdd")
+    private final String[] aliasesToAdd;
+
+    @JsonProperty("aliasesToRemove")
+    private final String[] aliasesToRemove;
+
+    /** {@inheritDoc} */
+    @Override
+    public ModelVersionChange modelVersionChange() {
+      return ModelVersionChange.updateAliases(aliasesToAdd, aliasesToRemove);
+    }
+
+    /**
+     * Validates the request
+     *
+     * @throws IllegalArgumentException If the request is invalid, this 
exception is thrown.
+     */
+    @Override
+    public void validate() throws IllegalArgumentException {
+      Preconditions.checkNotNull(aliasesToAdd, "aliasesToAdd field is required 
and cannot be null");
+      Preconditions.checkNotNull(
+          aliasesToRemove, "aliasesToRemove field is required and cannot be 
null");

Review Comment:
   I think the checking condition for Java is inconsistent with Python one. 
Also, I think either `aliasesToAdd` or `aliasesToRemove` can be null, right?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to