Ran into this issue today when faking a model. It seems that using class as a variable name within the build section of the yaml file throws the following error:
✖ Models (0/1)
[16:33:25] ✖ error: Error: Function Error in model 'test', for property: properties._class.data.build, Reason: Unexpected token class
at /root/.nvm/versions/node/v10.0.0/lib/node_modules/fakeit/dist/models.js:724:13
at Array.forEach (<anonymous>)
at parseModelFunctions (/root/.nvm/versions/node/v10.0.0/lib/node_modules/fakeit/dist/models.js:680:9)
at Models._callee4$ (/root/.nvm/versions/node/v10.0.0/lib/node_modules/fakeit/dist/models.js:577:17)
at tryCatch (/root/.nvm/versions/node/v10.0.0/lib/node_modules/fakeit/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/root/.nvm/versions/node/v10.0.0/lib/node_modules/fakeit/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/root/.nvm/versions/node/v10.0.0/lib/node_modules/fakeit/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/root/.nvm/versions/node/v10.0.0/lib/node_modules/fakeit/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
To fix the issue, I simply prefaced the variable with an underscore _class
A partial example of the yaml section throwing the error above is listed here:
_class:
description: spring data _class
data:
type: string
build: |
let class = "com.my.java.package.name.here"
return class;
Ran into this issue today when faking a model. It seems that using
class
as a variable name within the build section of the yaml file throws the following error:To fix the issue, I simply prefaced the variable with an underscore
_class
A partial example of the yaml section throwing the error above is listed here: