[Docs] Example config.json for `lb4 <command>` except `lb4 app` shows the app-config.json
Description / Steps to reproduce / Feature proposal
In the CLI generator docs e.g. https://loopback.io/doc/en/lb4/Model-generator.html, the example --config option shows the lb4 app example. This is true for Application, Datasource, Repository, etc. generators (7 generators in total).
Expected Behavior
We should show the appropriate config json file that the commands are expecting. Find a dynamic way to update https://github.com/strongloop/loopback-next/blob/master/docs/site/includes/CLI-std-options.md for each command.
- example for
lb4 model(cross posting from https://github.com/strongloop/loopback-next/issues/1517#issuecomment-433522659)
{
"name": "Customer",
"base": "Entity",
"properties": {
"id": {
"type": "number",
"id": true,
"required": false
},
"name": {
"type": "string",
"length": 200,
"id": false,
"required": true
}
}
}
- example for
lb4 controller(cross posting from https://github.com/strongloop/loopback-next/pull/2181#issuecomment-449485669 from @elv1s ):
{
"name": "Widget",
"modelName": "Widget",
"controllerType": "REST Controller with CRUD functions",
"repositoryName": "WidgetRepository",
"idType": "string",
"httpPathName": "/widget"
}
"controllerType": "REST Controller with CRUD functions",
This looks like an unintentional bug to me. We should use a languange-independent key, e.g. REST or RestController instead of a full name that will be (most likely) subject to localization into different languages in the future.
@dhmlau
if lb4 JSON model property has an object or object array it doesn't work. For example:
"properties": { "id": { "type": "string", "mcpAnnotations": [ { "destinationClass": "defClass", "destinationField": "name", "prefix": "/Common/profile_for_" } ] } }
The model output look like this:
@property({ type: 'string', mcpAnnotations: [object Object], required: true, id: true, }) id: string;
I think the cli/generators/model/templates/model.ts.ejs should be fixed with JSON.stringify for object instances.
if lb4 JSON model property has an object or object array it doesn't work. For example:
@yanamg7 This is a different problem, possibly related to https://github.com/strongloop/loopback-next/issues/2953. Please open a new issue to discuss it.
The issue about array of objects into the property is already fixed. Now this is just on one line instead of columns exactly related to #2953.