ffc-pay-etl-framework
Version:
A framework for creating ETL pipelines in node
82 lines (56 loc) • 1.77 kB
Markdown
# Validators
Validators are expected to check specific columns within each row against specific validation rules
Currently supported destinations are :
- RequiredValidator
- UniqueValidator
- MultiToolValidator
## RequiredValidator
### Options
| option | description |
| -------------- | ------------------------------------------------------------- |
| columns | Array of column indexes |
### Usage
```js
Validators.RequiredValidator({
columns: [0]
})
```
### Example
examples/csv-required-validator.js
## UniqueValidator
### Options
| option | description |
| -------------- | ------------------------------------------------------------- |
| column | Column to be tested for uniqueness |
### Usage
```js
Validators.UniqueValidator(
{ column: "field_one" }
)
```
### Example
examples/csv-unique-validator.js
## MultiToolValidator
### Options
| option | description |
| -------------- | ------------------------------------------------------------- |
| column | Column to be tested for validity and validator specification |
NB Any validators specified [here](https://github.com/validatorjs/validator.js) can be used
### Usage
```js
Validators.MultiToolValidator( { columns: [
{
name: "SOIL TYPE PERCENT (Percent)",
validator: "isAlphanumeric",
args: {
locale: "en-GB",
options: {
ignore: "-;%/ "
}
}
}
]
})
```
### Example
examples/csv-multi-tool-validator.js