A comprehensive plugin for validating and transforming string data during the Flatfile import process with configurable validation rules, pattern matching, and automatic data corrections.
StringValidationConfig
object with the following properties:
leading
is true, it trims whitespace from the start. If trailing
is true, it trims from the end. If the string is trimmed, the value is transformed, and a message is added.recordHook
that listens for new commits and applies the specified string validations to each record.
Parameters:
config
(StringValidationConfig): An object that defines the validation and transformation rules.FlatfileListener
instance and attaches the validation logic to it.
value
(string): The input string to validate and transform.config
(StringValidationConfig): The configuration object defining the rules to apply.ValidationResult
with two properties:
value
(string): The original or transformed string value.error
(string | null): An error message string if any validation fails, otherwise null
.emptyStringAllowed: true
in the configuration.sheetSlug
is specified, the plugin applies to all sheets in the workbook using the default value ’**’.errorMessages
configuration option.@flatfile/plugin-record-hook
, which is a dependency. It processes records individually during the commit:created
event.record.set()
.null
and undefined
values by simply skipping them. Validation is only applied to defined string values.record.addError(field, message)
. These errors are then visible to the user in the Flatfile UI.