[REQ][typescript-inversify] Change 'optional' behavior
Created by: siada
Is your feature request related to a problem? Please describe.
When generating models for a .net API, I have to add the [Required] attribute to every model property to avoid the typescript-inversify generator creating view model properties as optional.
The problem with them being optional is typescripts 'undefined by default' approach - you end up with a lot of undefined checks against properties that are never going to be undefined.
The problem this causes is the model validator on the .net side is validating properties as [Required] that are actually allowed to be null - but they're defined as [Required] so typescript-inversify doesn't try to make them undefined
Describe the solution you'd like
Change the default behaviour of declaring a typescript-inversify model property from:
name?: string
to a union type:
name: string | null