Non-lowercase type aliases don't work
Opened this issue · 0 comments
raphinesse commented
const sp = require('schemapack')
sp.addTypeAlias('edgeId', 'uint32')
sp.build('edgeId')
The code above will throw a this error:
TypeError: Invalid data type for schema: edgeId -> edgeid
at getDataType (schemapack.js:22:51)
at compileSchema (schemapack.js:349:24)
at getCompiledSchema (schemapack.js:369:3)
at Object.build (schemapack.js:382:21)
...
This happens because before lookup, aliases get lowercased but before creation, they don't. In the docs I could find no mention of type names having to be lowercase.
IMHO, the .toLowerCase()
I linked above has to be removed.