-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum constraint with arrays in table schema #549
Comments
@jungshadow
Based on this words for the
And valid data values will be:
Could you share your data package to better understand the use case? |
Thanks for the update, @roll!
I admit though the structure is a bit confusing. First, does the file I mentioned above, {
"name": "ApplicationRequestStatusType",
"type": "array",
"title": "Application Request Status",
"description": "Specifies the current status of the application. …",
"constraints": {
"required": true,
"enum": [
["duplicate"],
["missing-ssn", "pending"],
["invalid"],
["missing-ssn", "missing-state-id-number"],
["pending"],
["valid"]
]
}
} (NB: worth noting that the above scenario isn't indicative of real state policy, just a hypothetical example) If any combination of the
Certainly. The datapackage is here and the documentation for the various fields is here. |
Based on this description the type of the field could be a
|
@roll I apologize if I'm not being entirely clear (and it looks like I need to update the description in the documentation, so thanks for pointing that out). I want the ability to capture multiple values from the enum, so the array field type is the most appropriate for my use case, but I don't want to limit to only certain combinations of values. My use case above was only to illustrate how I thought wrapping the enum strings in arrays would work, not that I need it to work as such. |
@jungshadow |
Bummer. As a stop-gap, if I wrap all the
If so, great! Personally, I'm still advocating for the separation of duties I outlined above (i.e. |
@jungshadow |
@roll That's a bummer. This project is somewhat of a fact-finding mission. Currently, we're not sure how many or which of the |
@jungshadow name: ApplicationRequestStatusType
type: string
constraints:
pattern: '^((missing-ssn|missing-voter-signature|...)\|?)+$' # not tested With data like:
Related to the possible specs changes I'm cc here @pwalsh @rufuspollock |
I appreciate the quick fix, @roll! This isn't a knock on the fix and maybe I'm being overly pedantic, but this functionally seems more like an array than a string. Interested in @pwalsh's and @rufuspollock's thoughts on this, too. |
This is a perfect application of the 'itemType' property I suggested here: #409 So - you'd have an array, and you'll be able to state the inner item type (in this case, a string with an enum constraint). |
@akariv Sounds like that would work perfectly. I noticed @rufuspollock mentioned it may go into 1.1. Is there a rough timeline for it? Thinking aloud, I'm still wondering about the usefulness of a |
Hi @roll, @rufuspollock, and @pwalsh! Wanted to quickly bump this thread. Any ideas on this or a possible timeline for #409, which may similarly work for my purposes? Thanks! |
@jungshadow right now we don't have an ETA on new features for 1.1 but my guess is H2 this year (the real constraint is resourcing work on this). What really helps us is:
|
@rufuspollock I completely understand and I'd be happy to do either of the above, but it would be helpful to have some idea on which implementation to focus. Would it be more helpful to keep it narrowly focused on my use case or should I concentrate on the idea in #409? |
Considering the discussion in frictionlessdata/tableschema-js#152, I wanted to quickly bump this, again. Is #409 the recommended approach or should we carve out a case for this particular issue? /cc @roll @rufuspollock |
Any update on adding this? |
DUPLICATE / MERGING. Closing in favour of #409 since doing that appropriately would resolve this. |
I'm using an array field with an enum constraint that consists of an array of strings:
I’m trying to save a datapackage–using Package–but running into validation errors. The error that’s being thrown is
Field "ApplicationRequestStatusType" can't cast value "duplicate" for type "array" with format “default"
.From my Gitter conversation with @roll:
I believe I'm implementing this correctly and it looks like both types of enum constraints (e.g. array of strings and array of arrays) are supported based on the table-schema.json file:
Is my assessment that my previous snippet is technically correct, accurate? My use case is to constrain an array (prefer a set in this case) to a list of potential values (the strings in the example above). Thanks!
The text was updated successfully, but these errors were encountered: