Data-Liberation-Front / csvlint.rb

The gem behind http://csvlint.io
MIT License
283 stars 86 forks source link

Analyse "schema" objects and not only { } #202

Open quadrophobiac opened 7 years ago

quadrophobiac commented 7 years ago

From @CharlesNepote on March 28, 2017 22:36

For the moment, schemas are parsed from an unamed object { }, like in: https://gist.githubusercontent.com/ldodds/9070198/raw/44076fa619d9c89188197130ca596cc99a25d693/senior-staff-organagram.json

In frictionlessdata specs and elsewhere, schemas might be embeded in another objects, like in Tabular Data spec: http://specs.frictionlessdata.io/tabular-data-package/#examples

datapackage.json
----------------

{
  "name": "my-dataset",
  "resources": [
    {
      "data": [ "data.csv" ],
      "schema": {
        "fields": [
          {
            "name": "var1",
            "type": "string"
          }
        ]
      }
    }
  ]
}

I'm also currently working on schemas embeded in a { "schema": { } } object, like in: https://gist.githubusercontent.com/anonymous/1a6e20bd47945e9d8152ef43f5908082/raw/db03dd8938896c36914b6d9f73846e8148d6be58/schema.json

I think that CSV Lint could search for the "schema" object and parse this one. For the moment, CSV Lint treat it as an "Empty schema", see: http://csvlint.io/validation/58dade893235610004000051

Copied from original issue: theodi/csvlint#280

quadrophobiac commented 7 years ago

Hi @CharlesNepote, thanks for flagging this up for us. I am thinking this issue better belongs in the CSVlint Library repository due to it addressing schema validation, which is a function of the library more than the service. What do you think - would you mind if I closed and reopened the issue against the CSVlint library, and tag you so you can be kept updated on progress on it?