Skip to content

Commit

Permalink
MAINT: Add json property descriptions for csv processor (#4751)
Browse files Browse the repository at this point in the history
* add json property descriptions
Signed-off-by: Katherine Shen <[email protected]>
  • Loading branch information
shenkw1 authored Jul 22, 2024
1 parent afe8464 commit bbfaef6
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 bbfaef6

Please sign in to comment.