Open JDziurlaj opened 5 years ago
@JDziurlaj Don't you mind taking a look at https://github.com/frictionlessdata/tableschema-js/blob/master/src/schema.js if you can? It's probably a simple bug there. Unfortunately, we don't have time for fixing it the upcoming weeks.
And thank you for reporting! :+1:
Hi @roll,
From what I can tell, the error is caused by the Field
class (src/field.js
) trying to cast the enum constraint (lines 166-169). This causes each enumeration literal to be cast by the Field's data type (array), and throwing an exception when the literal is parsed as JSON, i.e. JSON.parse("enum-value")
.
I'm not sure what the purpose of the cast is here (perhaps to normalize input?), but commenting lines 166-169 out seems to fix this issue, while not causing any regressions on the test suite.
@JDziurlaj Thanks! Now I see where is the problem - https://github.com/frictionlessdata/specs/issues/549. It's the specs related.
I've run into a situation where the definition of a field as
type: "array"
and an enum constraint results in thefieldName
becoming listed asundefined