adewg / ICAR

Standard messages and specifications for animal data exchange in livestock.
https://icar.org/
Apache License 2.0
49 stars 26 forks source link

Inventory classification change - fix birthPeriod validation #334

Closed cookeac closed 2 years ago

cookeac commented 2 years ago

birthPeriod was previously specified as an icarDateType, which is half-right, because it is a date range. Most validators interpret "format": "date" as an RFC3339 date, which does not allow for ranges.

Instead I have changed its type to string, and defined a pattern with a regex. If this is too complex we can ditch the regex and simply make it a string with the current description.

cookeac commented 2 years ago

Having tested this in https://regex101.com/ there are three effective captures:

image

So I think the optionality is right, but would be willing to accept corrections :-) The remaining questions are: