inbo / whip

✅ Human and machine-readable syntax to express specifications for data
MIT License
7 stars 0 forks source link

Can we get rid of "type", but then how to define an integer? #14

Closed peterdesmet closed 6 years ago

peterdesmet commented 7 years ago

The syntax still lists type at https://github.com/inbo/whip/blame/master/docs/syntax.md#L398, but that is not defined. I hope that specification can be removed, but than the question remains how that example can be redefined:

postalcode:
  type: integer

@stijnvanhoey, maybe as:

postalcode:
  numberformat: x # How can you define an integer of unspecified length?
peterdesmet commented 7 years ago

Same for defining an unspecified float, would that be:

decimalLatitude:
  numberformat: '.'
stijnvanhoey commented 7 years ago

"I hope that specification can be removed"

Why getting rid of the type specification? Do we want (and can we) capture all the use-cases of having integer or floats using the numberformat specification, taking into account we add the your two suggestions:

postalcode:
  numberformat: x # How can you define an integer of unspecified length?
decimalLatitude:
  numberformat: '.'
stijnvanhoey commented 7 years ago

Let's say we exclude the type option, then it should be clear that for the min/max rules, a coercing towards floats is required before the comparison of the value can be done. Moreover, the comparison is always as float?

So, should we specifically require a numberformat specification when a min or max specification is provided?

stijnvanhoey commented 6 years ago

The necessity of type to handle min and max rules has been removed from the code in pywhip, still need to check the extension on the numberformat.

stijnvanhoey commented 6 years ago

This is in the whip statements, closing here.