brighthive/data-resource-api

Update descriptors to use table schema constraints correctly

loganripplinger opened this issue · 2 comments

Currently

Currently we list required along with the other properties in an object within the fields array.

"datastore": {
      "schema": {
        "fields": [
          {
            "name": "id",
            "title": "Test ID",
            "description": "Test Desc",
            "type": "integer",
            "required": True
          },
          {
            "name": "name",
            "title": "namename",
            "description": "test name",
            "type": "string",
            "required": True
          }
        ],
        "primaryKey": "id"
      }
    }

Desired

Per the table schema spec it appears that required should be nested within a constraints property, https://frictionlessdata.io/specs/table-schema/#constraints

"datastore": {
      "schema": {
        "fields": [
          {
            "name": "id",
            "title": "Test ID",
            "description": "Test Desc",
            "type": "integer",
            "constraints": {
                "required": True
            }
          },
          {
            "name": "name",
            "title": "namename",
            "description": "test name",
            "type": "string",
            "constraints": {
                "required": True
            }
          }
        ],
        "primaryKey": "id"
      }
    }

It is quite possible that I misread the specification or it changed since the implementation. Yes, this makes a lot of sense to do correctly and should be a relatively easy lift.

@loganripplinger whenever you or I get to this, we need to remember that older versions of specifications need to be updated to have this new level of nesting.