Skip to content

Commit

Permalink
MAINT: Add json property descriptions for csv processor (opensearch-p…
Browse files Browse the repository at this point in the history
…roject#4751)

* add json property descriptions
Signed-off-by: Katherine Shen <katshen@amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
  • Loading branch information
shenkw1 authored and Krishna Kondaka committed Jul 23, 2024
1 parent ba49029 commit ad37799
Showing 1 changed file with 22 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.csv;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import jakarta.validation.constraints.AssertTrue;

import java.util.List;
Expand All @@ -20,24 +21,45 @@ public class CsvProcessorConfig {
static final Boolean DEFAULT_DELETE_HEADERS = true;

@JsonProperty("source")
@JsonPropertyDescription("The field in the event that will be parsed. Default value is `message`.")
private String source = DEFAULT_SOURCE;

@JsonProperty("delimiter")
@JsonPropertyDescription("The character separating each column. Default value is `,`.")
private String delimiter = DEFAULT_DELIMITER;

@JsonProperty("delete_header")
@JsonPropertyDescription("If specified, the event header (`column_names_source_key`) is deleted after the event " +
"is parsed. If there is no event header, no action is taken. Default value is true.")
private Boolean deleteHeader = DEFAULT_DELETE_HEADERS;

@JsonProperty("quote_character")
@JsonPropertyDescription("The character used as a text qualifier for a single column of data. " +
"Default value is `\"`.")
private String quoteCharacter = DEFAULT_QUOTE_CHARACTER;

@JsonProperty("column_names_source_key")
@JsonPropertyDescription("The field in the event that specifies the CSV column names, which will be " +
"automatically detected. If there need to be extra column names, the column names are automatically " +
"generated according to their index. If `column_names` is also defined, the header in " +
"`column_names_source_key` can also be used to generate the event fields. " +
"If too few columns are specified in this field, the remaining column names are automatically generated. " +
"If too many column names are specified in this field, the CSV processor omits the extra column names.")
private String columnNamesSourceKey;

@JsonProperty("column_names")
@JsonPropertyDescription("User-specified names for the CSV columns. " +
"Default value is `[column1, column2, ..., columnN]` if there are no columns of data in the CSV " +
"record and `column_names_source_key` is not defined. If `column_names_source_key` is defined, " +
"the header in `column_names_source_key` generates the event fields. If too few columns are specified " +
"in this field, the remaining column names are automatically generated. " +
"If too many column names are specified in this field, the CSV processor omits the extra column names.")
private List<String> columnNames;

@JsonProperty("csv_when")
@JsonPropertyDescription("Allows you to specify a [conditional expression](https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/), " +
"such as `/some-key == \"test\"`, that will be evaluated to determine whether " +
"the processor should be applied to the event.")
private String csvWhen;

/**
Expand Down

0 comments on commit ad37799

Please sign in to comment.