data-models icon indicating copy to clipboard operation
data-models copied to clipboard

Standardize field attributes

Open gracebrownecodes opened this issue 9 years ago • 4 comments

The json-table-schema spec gives the following attributes:

  • name
  • title
  • description
  • type drawn from string, number, integer, boolean, null, object, array, datetime, date, time, duration, geopoint, geojson, any
  • format for date/time fields, drawn from default (ISO6801), any (parseable by standard libraries), fmt:PATTERN with a strptime-style PATTERN

and the following constraint attributes:

  • required (not null)
  • minLength
  • maxLength
  • pattern (regex to test values against)
  • minimum
  • maximum
  • enum

I think to this we should add:

  • precision and scale for number fields
  • tags see #92

gracebrownecodes avatar Feb 02 '16 15:02 gracebrownecodes

I think it's also worth keeping the default attribute.

gracebrownecodes avatar Feb 02 '16 15:02 gracebrownecodes

Re: precision, scale, and maxLength, I think it would be better to add separate precision and scale attributes. If you co-opt maxLength, it seems like it should be for precision, since that's the total number of digits, although doing so may cause confusion because people will not know if the decimal point is included in the "length".

murphyke avatar Feb 02 '16 16:02 murphyke

Yeah, I got precision and scale confused, obviously. What terrible names. Anyway, I think you're right that we shouldn't co-opt maxLength for this purpose and instead should use separate attributes.

gracebrownecodes avatar Feb 02 '16 17:02 gracebrownecodes

They are truly horrible names; I have to look them up whenever I have to deal with them.

murphyke avatar Feb 02 '16 17:02 murphyke