Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraints are applied even if the column is nullable #213

Open
mtsmfm opened this issue Nov 16, 2017 · 0 comments
Open

Constraints are applied even if the column is nullable #213

mtsmfm opened this issue Nov 16, 2017 · 0 comments

Comments

@mtsmfm
Copy link

mtsmfm commented Nov 16, 2017

Constraints are applied even if the column is nullable.
Is it intentional?

app@b1823785e3ed:/app$ cat foo.csv
id,foo
1,
2,x
3,xx
app@b1823785e3ed:/app$ cat foo.json
{
  "fields": [
    {
      "name": "id",
      "type": "integer",
      "constraints": {
        "required": true
      }
    },
    {
      "name": "foo",
      "type": "string",
      "constraints": {
        "required": false,
        "minLength": 2
      }
    }
  ]
}
app@b1823785e3ed:/app$ bundle exec bin/csvlint foo.csv --schema=foo.json
NOTE: Csvlint::Schema.load_from_json is deprecated; use load_from_uri instead. It will be removed on or after 2018-01-01.
Csvlint::Schema.load_from_json called from /app/lib/csvlint/cli.rb:59.
.!!.
foo.csv is INVALID
1. foo: min_length. Row: 2,2.
2. foo: min_length. Row: 3,2. x

Expected Behaviour

foo.csv is VALID

Current Behaviour (for problems)

foo.csv is INVALID
1. foo: min_length. Row: 2,2.
2. foo: min_length. Row: 3,2. x

Your Environment

  • Docker for mac
  • Ruby 2.4.2 (latest official ruby image)
  • CSV lint v0.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant