loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Camel casing is removed in model name when created with slc loopback:model

Open kamal0808 opened this issue 9 years ago • 4 comments

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 as Mynewmodel instead of MyNewModel.

Expected result

  • It should write module name as MyNewModel instead of Mynewmodel.

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

kamal0808 avatar Mar 24 '17 14:03 kamal0808

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 avatar Apr 03 '17 20:04 siddhipai

@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.

kamal0808 avatar Apr 03 '17 20:04 kamal0808

@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 avatar Apr 03 '17 22:04 superkhau

@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.

kamal0808 avatar Sep 11 '17 04:09 kamal0808