csvlint.io icon indicating copy to clipboard operation
csvlint.io copied to clipboard

Required constraint not working

Open AndyNichols opened this issue 11 years ago • 2 comments

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

AndyNichols avatar Jun 04 '14 11:06 AndyNichols

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.

pezholio avatar Jun 27 '14 15:06 pezholio

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.

scrybbler avatar Jun 02 '15 20:06 scrybbler