-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
@@ -248,6 +248,39 @@ The field contains data that is a valid JSON format arrays. | |||
|
|||
`format`: no options (other than the default). | |||
|
|||
Additional properties: | |||
|
|||
- **arrayItem**: an array field can be customized by the `arrayItem` property. If provided, `arrayItem` `MUST` be a `field`, an object describing a field as per the Table Schema specification (TODO: cross-link when `field` is a linkable entity). Each array item `MUST` conform to the provided field definition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In JSON Schema it's called items
instead of arrayItem
so I'd also use items
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in #409 the name is inspired by other properties like bareNumber
etc. Personally, I don't have any preferences
"name": "array", | ||
"type": "array" | ||
"arrayItem": { | ||
"name": "value", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the prupose of a name
here? An array field of name "foo" has "foo items", thats enough names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the problem with this proposal -- it's quite hard not to get into a rabbit hole. I used a simple version just saying that the arrayItem
needs to be a field
entity which automatically requires name
to be present
TBH, I'm not sure if this feature is worth the complexity it brings. Maybe it will be still enough just to have On the other hand, |
In doubt, I'd not add this feature before there is an actual use case. There are other issues to be done first. |
Agree with @nichtich, not clear what actual use case this solves. |
I think the most pressing feature request is described here - frictionlessdata/datapackage#409 (comment) - an ability to have typed arrays compatible e.g. with SQL. Maybe we can just use the simplest solution like |
I would very much like this property! My most pressing use case for typed arrays is for being able to express multiselect survey item types in a single field, instead of needing to explode the field as a boolean field for each possible option. For example, using the categorical type we're proposing in #875:
I would also vote for naming the field |
I'd suggest to rename the property to
The example provided by khusmann looks good but opens even more questions as |
Good questions, my thoughts below:
Good point, this might open a can of worms. Perhaps we start out only supporting primitive types as itemTypes, with the option to later include complex / recursive definitions after we've thought about it more.
I'd say an
As above, I'd expect constraints on the array field should apply to the array as a generic container (e.g. {
"name": "favorite_numbers",
"description": "List up to 3 of your favorite numbers between 1 and 10",
"type": "array",
"itemType": {
"type": "number",
"constraints": {
"minimum": 1,
"maximum": 10
}
},
"constraints": {
"maxLength": 3
}
} |
OK, I also voted |
VETOED by WG |
itemType
constraint toarray
type datapackage#409Rationale
Please see the attached discussion.
Problems
It's not clear how to define the property in JSON Schema as current build system doesn't output JSON Schema definitions.
Implementations