From 9d6510d14696e575088d433a4e59dda26a0ba8de Mon Sep 17 00:00:00 2001 From: Dinu John <86094133+dinujoh@users.noreply.github.com> Date: Tue, 14 May 2024 17:35:08 -0500 Subject: [PATCH] Add validation for DocumentDB Collection Config Signed-off-by: Dinu John <86094133+dinujoh@users.noreply.github.com> --- .../plugins/mongo/configuration/CollectionConfig.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data-prepper-plugins/mongodb/src/main/java/org/opensearch/dataprepper/plugins/mongo/configuration/CollectionConfig.java b/data-prepper-plugins/mongodb/src/main/java/org/opensearch/dataprepper/plugins/mongo/configuration/CollectionConfig.java index e1a6a69a70..ee68798886 100644 --- a/data-prepper-plugins/mongodb/src/main/java/org/opensearch/dataprepper/plugins/mongo/configuration/CollectionConfig.java +++ b/data-prepper-plugins/mongodb/src/main/java/org/opensearch/dataprepper/plugins/mongo/configuration/CollectionConfig.java @@ -1,6 +1,8 @@ package org.opensearch.dataprepper.plugins.mongo.configuration; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Pattern; @@ -23,11 +25,17 @@ public class CollectionConfig { private boolean stream; @JsonProperty("partition_count") + @Min(1) + @Max(1000) private int partitionCount; @JsonProperty("export_batch_size") + @Min(1) + @Max(1_000_000) private int exportBatchSize; @JsonProperty("stream_batch_size") + @Min(1) + @Max(1_000_000) private int streamBatchSize; public CollectionConfig() {