Skip to content

Commit

Permalink
MAINT: backfill documentation into json description for truncate proc…
Browse files Browse the repository at this point in the history
…essor (opensearch-project#4726)

* MAINT: backfill documentation into json description for truncate processor

Signed-off-by: George Chen <[email protected]>
  • Loading branch information
chenqi0805 authored Jul 12, 2024
1 parent 59a4df4 commit 8fac7cf
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.opensearch.dataprepper.plugins.processor.truncate;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.AssertTrue;
Expand All @@ -16,18 +17,25 @@
public class TruncateProcessorConfig {
public static class Entry {
@JsonProperty("source_keys")
@JsonPropertyDescription("The list of source keys that will be modified by the processor. " +
"The default value is an empty list, which indicates that all values will be truncated.")
private List<String> sourceKeys;

@JsonProperty("start_at")
@JsonPropertyDescription("Where in the string value to start truncation. " +
"Default is `0`, which specifies to start truncation at the beginning of each key's value.")
private Integer startAt;

@JsonProperty("length")
@JsonPropertyDescription("The length of the string after truncation. " +
"When not specified, the processor will measure the length based on where the string ends.")
private Integer length;

@JsonProperty("recursive")
private Boolean recurse = false;

@JsonProperty("truncate_when")
@JsonPropertyDescription("A condition that, when met, determines when the truncate operation is performed.")
private String truncateWhen;

public Entry(final List<String> sourceKeys, final Integer startAt, final Integer length, final String truncateWhen, final Boolean recurse) {
Expand Down Expand Up @@ -77,6 +85,7 @@ public boolean isValidConfig() {

@NotEmpty
@NotNull
@JsonPropertyDescription("A list of entries to add to an event.")
private List<@Valid Entry> entries;

public List<Entry> getEntries() {
Expand Down

0 comments on commit 8fac7cf

Please sign in to comment.