Skip to content

Commit

Permalink
enum string check
Browse files Browse the repository at this point in the history
Signed-off-by: Maxwell Brown <[email protected]>
  • Loading branch information
Galactus22625 committed Jan 3, 2025
1 parent c8636fd commit da25170
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ public class ActionConfiguration {
@JsonProperty("type")
private OpenSearchBulkActions type;

@AssertTrue(message = "type must be one of index, create, update, upsert, delete")
boolean isTypeValid() {
if (type == null) { //type will be null if the string doesnt match one of the enums
return true;
}
return false;
}

public String getType() {
return type.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ public boolean getEnableRequestCompression() {
@JsonProperty("action")
private OpenSearchBulkActions action = OpenSearchBulkActions.INDEX;

@AssertTrue(message = "action must be one of index, create, update, upsert, delete")
boolean isActionValid() {
if (action == null) { //action will be null if the string doesn't match one of the enums
return true;
}
return false;
}

public String getAction() {
return action.toString();
}
Expand Down

0 comments on commit da25170

Please sign in to comment.