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
  • #8162
Closed
Open
Issue created Dec 11, 2020 by Administrator@rootContributor

[REQ] [csharp],[csharp-netcore] Add Parameter Less Default Constructors For Model Classes

Created by: GauravQ

I've been using openapi-generator-cli for generating APIClient Nugets to be used in .Net Framework, .Net Core Web Apps.

But I'm not able to use generated models as parameter in a [Post] Action methods as default conversion from Post Body (JSON) to Class Object requires a parameter less constructor (a default constructor). But the generated models only have a parameterized constructor, which then results in an error.

Probable solution

Adding a default constructor in all Model classes will be very helpful.

As of now the only solution is to create similar Model classes in Web App itself and when calling an API convert that Web App's Model To APIClient's Model (generated model).

Here's how its being generated using v4.3.1

image

And here's how it could be generated to resolve the issue. having a default constructor with another parameterized constructor

image

Not sure how much work is needed here, but i would really appreciate if we can have this added.

Assignee
Assign to
Time tracking