Correct use of CSV Dialect?


#1

The example for using the CSV Dialect within a Tabular Data Package are unclear to me. I’ve said so on GitHub.

Is this the correct way to include a CSV Dialect?

  "schema": {
    "fields": [
      {
        "name": "id",
        "type": "integer"
      },
      {
        "name": "name",
        "type": "string"
      },
      {
        "name": "description",
        "type": "string"
      }
    ],
    "primaryKey": "id"
  },
  "sources": "",
  "licenses": "CC-BY 4.0",
  "csvddfVersion": 1.0,
  "delimiter": ",",
  "doubleQuote": true,
  "lineTerminator": "\r\n",
  "quoteChar": "\"",
  "skipInitialSpace": true,
  "header": true

#2

I agree it is confusing. The example represents the value of the dialect object on the Tabular Data Resource. So, rather write:

  "schema": {
    "fields": [
      {
        "name": "id",
        "type": "integer"
      },
      {
        "name": "name",
        "type": "string"
      },
      {
        "name": "description",
        "type": "string"
      }
    ],
    "primaryKey": "id"
  },
  "sources": "",
  "licenses": "CC-BY 4.0",
  "dialect": {
    "csvddfVersion": 1.0,
    "delimiter": ",",
    "doubleQuote": true,
    "lineTerminator": "\r\n",
    "quoteChar": "\"",
    "skipInitialSpace": true,
    "header": true
  }