Skip to content

Commit

Permalink
fix 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 da25170 commit df7c929
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import org.apache.commons.lang3.EnumUtils;
import org.opensearch.dataprepper.model.opensearch.OpenSearchBulkActions;

public class ActionConfiguration {
@Size(min = 1, message = "type cannot be empty")
@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;
@AssertTrue(message = "action must be one of index, create, update, upsert, delete")
boolean isActionValid() {
if (type == null) { //type will be null if the string doesn't match one of the enums
return false;
}
return false;
return true;
}

public String getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public boolean getEnableRequestCompression() {
@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;
}
return false;
return true;
}

public String getAction() {
Expand Down

0 comments on commit df7c929

Please sign in to comment.