Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5543
Closed
Open
Issue created Mar 06, 2020 by Administrator@rootContributor

[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

Assignee
Assign to
Time tracking