Data-Liberation-Front / csvlint.io

Check that your CSV files are valid
http://csvlint.io
MIT License
73 stars 11 forks source link

Required constraint not working #151

Open AndyNichols opened 10 years ago

AndyNichols commented 10 years ago

See http://csvlint.io/validation/538efbb563737671383c0100 Amongst the 1262 errors there is nothing about StatusLabel. StatusLabel is empty in all rows of the csv file and is defined in the schema as:

    {
        "name": "StatusLabel",
        "title": "Status Label",
        "description": "Label of the StatusURI",
        "constraints": {
            "required": "true",
            "type": "http://www.w3.org/2001/XMLSchema#string"
        }
    }

so I would expect an error per row saying that it is required but missing. As per the about page which states

Constraint Value type Description
required boolean if true, there must be a value in this column on every row
pezholio commented 10 years ago

Ah, OK. Try this instead:

    {
        "name": "StatusLabel",
        "title": "Status Label",
        "description": "Label of the StatusURI",
        "constraints": {
            "required": true,
            "type": "http://www.w3.org/2001/XMLSchema#string"
        }
    }

Note the lack of quotes in "true". I think it's getting picked up as a string, rather than a boolean.

scrybbler commented 9 years ago

Andy's URL is 404 but fyi, the required constraint is not working for me today either.

Here are my csv and schema respectively: https://drive.google.com/file/d/0B3CDKorSOdGNNm1CbXFrUmlFY1U/view?usp=sharing https://drive.google.com/file/d/0B3CDKorSOdGNN3JlZ2pDLWNKaXc/view?usp=sharing

The required constraint is violated on lines 3 and 17 of the data.

The validator reports no errors or warnings on those data columns.