Data-Liberation-Front / csvlint.rb

The gem behind http://csvlint.io
MIT License
286 stars 87 forks source link

Custom Type #242

Open bekicot opened 4 years ago

bekicot commented 4 years ago

Currently we do type validation based on predefined type

Is it possible to register a new custom type? So that we can have a custom type validation?

If it is currently not possible and something that the maintainer allows, I can do a pull request for it.

The interface that I have in mind:

 Csvlint::Validator.new(csv_file, nil, {
  fields: [ {
    name: "Cutom Type",
    constraints: {
      type: ->(value) {}
    }
  }]