Type of minimum/maximum constraint should be the same of the field
See original GitHub issueAccording to the spec, the type of the minimum
/maximum
constraint should be the same as the constrained field. The examples given in the official table-schema respect this principle. Here is the example given in the official schema for an integer
:
{
"name": "age",
"type": "integer",
"constraints": {
"unique": true,
"minimum": 100,
"maximum": 9999
}
}
However, the spec for the minimum
and maximum
constraint expect their type
to be string
all the time. For example the spec for the minimum
constraint of an integer
:
{
"minimum": {
"type": "string",
"description": "A minimum value for the property, context specific for the property type, and conforming with the format for the property.",
"context": "This is different to `minLength`, which checks the number of items in the value. A `minimum` value constraint checks whether a field value is greater than or equal to the specified value."
}
}
Shouldn’t ☝️ be "type": "integer"
?
Same is true for other field types with minimum
and maximum
constraints.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Can Min or Max field values from Column Constraint...
Hi, I have a Kanban board with the Minimum and Maximum values set as constraints. However, I want to perform various events based...
Read more >java - Why do bean validation Min/Max constraints not support ...
Use the @DecimalMin annotation. You will need to pass a literal String value, because the attrubute value must be constant (String.
Read more >Max-Min Problems - UT Austin Wikis
Max -min problems, also known as optimization problems, are word problems that ask for the maximum or minimum values of a function, often...
Read more >Min and max constraints - Oracle Communities
I've set up all of my tables with PK and FK constraints and I'm wondering if you can enforce min and max column...
Read more >Anatomy of a Constraint - Auto Layout Guide - Apple Developer
For example, you can use constraints to define the minimum or maximum size for a view (Listing 3-3). Listing 3-3Assigning a minimum and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@georgiana-b It just has been added to the specs:
And on implementation level you just treat field’s data value and constraint value the same - https://github.com/frictionlessdata/tableschema-py/blob/master/tableschema/field.py#L153-L167
For example you have field:
with data
So you first just cast constraint to field type (‘20’ -> 20) and then compare to values also cast to data type (‘40’ -> 40).
@pwalsh Both will work for implementations for now. But if you’re in the mood for second option (i.e. have time=) it will be better. Though enum is also not typed.