23andMe / Yamale

A schema and validator for YAML.
MIT License
679 stars 88 forks source link

4.0.0 regression: nested lists raise SyntaxError #178

Closed jccurtis closed 3 years ago

jccurtis commented 3 years ago

Just noticed this in one of our project's CI pipelines. Nested lists seem to be broken with the 4.0.0 release. MWE follows:

import yamale
# works with yamale-3.0.8 and SyntaxError's in yamale-4.0.0
schema = yamale.make_schema(
    content="""
arr2d: list(list(num, min=2, max=2), min=2, max=2)
""")
data = yamale.make_data(content="""
arr2d: [[1,2], [3,4]]
""")
yamale.validate(schema, data)

Similar to #176 the fix includes quoting the literal to list:

import yamale
# works with yamale-3.0.8 and yamale-4.0.0
schema = yamale.make_schema(
    content="""
arr2d: list("list(num, min=2, max=2)", min=2, max=2)
""")
data = yamale.make_data(content="""
arr2d: [[1,2], [3,4]]
""")
yamale.validate(schema, data)
mildebrandt commented 3 years ago

Thank you for your report! We'll look into this as well and add more tests.

jccurtis commented 3 years ago

@mildebrandt thanks for the quick response! Let me know if you need any other info or tests. Happy to contrib.

mildebrandt commented 3 years ago

I appreciate it! I've bundled the fix for this in #177 along with the fix for #176. I'll post here when we're ready to merge.

mildebrandt commented 3 years ago

We've released 4.0.1 which fixes this problem. Thank you and please let us know if you find anything else!