The lb4 model command and answer the prompts that generate the model ask whether to "Allow additional (free-form) properties?".
What are the free-form properties? I suggest to add more info in the prompt as well as in the docs for this option.
What does it today is to add the following to generated TypeScript class:
export class MyModel {
name: string;
// This allow TypeScript to accept other properties that are not explicitly defined above
[prop: string]: any;
}
It also adds {settings: {strict: false}} to the @model() decorator:
@model({settings: {strict: false}})
export class MyModel {
name: string;
// This allow TypeScript to accept other properties that are not explicitly defined above
[prop: string]: any;
}
It allows you to add properties that you haven't defined in your model class. For example, if you have a model with properties id and content, then you can add a title property when making a POST request, whereas if the no additional properties were allowed, it would reject the request with a 422.
Thanks for the information.
Most helpful comment
It also adds
{settings: {strict: false}}to the@model()decorator:It allows you to add properties that you haven't defined in your model class. For example, if you have a model with properties
idandcontent, then you can add atitleproperty when making a POST request, whereas if the no additional properties were allowed, it would reject the request with a 422.