Skip to content
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

error loading field into schema where type = "array" and has "enum" constraint #230

Closed
roshcagra opened this issue Feb 12, 2019 · 2 comments

Comments

@roshcagra
Copy link

Sample schema.json:
{
"fields": [
{
"name": "field_name",
"type": "array",
"constraints": {
"enum": [
"option1",
"option2",
"option3"
]
}
}
]
}

Some exception is being raised though:
my_schema = Schema("schema.json")

my_schema.fields[0]

False

@roshcagra
Copy link
Author

roshcagra commented Feb 12, 2019

Figured out the error:

constraint = list(map(cast, constraint))

The enums in my example are all strings, but I guess they're supposed to be lists? If the enum constraint is specified for an "array" field like in the above example, is the expectation that the arrays for that field are in the enum or that the elements of the array are in the enum (I was assuming the second)?

@roshcagra
Copy link
Author

A larger issue with the spec: frictionlessdata/datapackage#549

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant