openreferral / specification

The Human Services Data Specification - a data exchange format developed by the Open Referral Initiative
https://openreferral.org
Other
117 stars 50 forks source link

"values" should be expressed as "constraints"/"enum" #100

Closed danfowler closed 7 years ago

danfowler commented 8 years ago

We can now specify that a given column must be one of several values in core JSON Table Schema. We can use the "enum" constraint for this:

http://specs.frictionlessdata.io/json-table-schema/#field-constraints

 {
  "name": "status",
  "description": "",
  "type": "string",
  "values": ["active", "inactive", "defunct", "temporarily closed"]
}

is better expressed as:

 {
  "name": "status",
  "description": "",
  "type": "string",
  "constraints": {
    "enum": ["active", "inactive", "defunct", "temporarily closed"]
  }
}
timgdavies commented 8 years ago

Thanks @danfowler for flagging this.

@robredpath If I don't get to it before you are working on docs generation next week, please update the sample data first so that you are working on the latest frictionless data specs.

robredpath commented 8 years ago

@timgdavies @danfowler 2512e77

NeilMcKLogic commented 8 years ago

This is great news, interoperability will be greatly improved if we constrain fields either to a finite list like this or at least a data type. As such, can we consider adding such "type" constraints to other fields like email addresses and ensure other obvious fields like boolean and date/datetime get these constraints too?

robredpath commented 8 years ago

Further constraints would be great for interoperability and we're likely to be recommending them for a future version of HSDS. Thanks @NeilMcKechnie !

robredpath commented 8 years ago

@NeilMcKechnie Issue #99 may be of interest to you as well.