In LB3, users could specify model settings at two levels: as a root property or inside options property.
See https://stackoverflow.com/q/53307168/69868 for an example of LB3 syntax applied in an LB4 project:
@model({
settings: {strict: false},
name: 'client',
plural: 'clients',
options: {
mongodb: {
collection: 'clients',
},
},
})
export class Client extends Entity {
// ...
}
I am proposing to make two changes in LB4 to help users coming from LB3:
-
Recognize options the same way as settings. In the example above, mongodb settings are not picked by LB4 now. With the proposed change in place, LB4 will set collection to clients as expected. Alternatively, tell the user setting options that they are trying to set an unsupported model-definition property. This can be done at compiler level too.
-
Allow settings to be provided as top-level properties, for example:
@model({
name: 'client',
strict: false,
mongodb: {
collection: 'clients',
},
})
export class Client extends Entity {
// ...
}
In LB3, users could specify model settings at two levels: as a root property or inside
optionsproperty.See https://stackoverflow.com/q/53307168/69868 for an example of LB3 syntax applied in an LB4 project:
I am proposing to make two changes in LB4 to help users coming from LB3:
Recognize
optionsthe same way assettings. In the example above,mongodbsettings are not picked by LB4 now. With the proposed change in place, LB4 will setcollectiontoclientsas expected. Alternatively, tell the user settingoptionsthat they are trying to set an unsupported model-definition property. This can be done at compiler level too.Allow settings to be provided as top-level properties, for example: