Camel casing is removed in model name when created with slc loopback:model
Description/Steps to reproduce
Creating a model with slc loopback:model removes Camel-casing names in modelName.js whereas keeps as-it-is in modelName.json.
Steps to reproduce:
- Go to terminal in your project dir and type
slc loopback:model - Write model name in camel casing. For example,
MyNewModel - Complete steps. Go to file
myNewModel.js, you'll find module name asMynewmodelinstead ofMyNewModel.
Expected result
- It should write module name as
MyNewModelinstead ofMynewmodel.
Additional information
darwin x64 5.12.0
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
npm ERR! invalid: [email protected] /Users/kamal/dev/Blubox/node_modules/loopback/node_modules/strong-remoting/node_modules/sse/node_modules/options
Hi @kamal0808 , You can refer this link which talks more about camel-casing. So this is the expected behaviour. https://loopback.io/doc/en/lb2/Model-definition-JSON-file.html#overview
@siddhipai Quoting from doc
For example, if you create a model named “FooBar” with the model generator, it creates files foo-bar.json and foo-bar.js in common/models. However, the model name (“FooBar”) will be preserved via the model’s name property.
However, the model name ("FooBar") IS NOT preserved via the model's name property. It changes to ("Foobar"). Please don't close this issue yet.
@siddhipai Please try to reproduce @kamal0808's issue and see if the behaviour if different from the docs. If so, we can escalate this to a bug.
@superkhau Are you sure this issue should be closed? I hope someone solved it but I don't see any reference to any pull request.