swagger-api / swagger-api/swagger-codegen

[Csharp] Bug - Constructors parameters are nameless

Open
#9,368 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When I generate based on my swagger, the classes constructors parameters are nameless, e.g.:
public MyClass(string = default(string)) and the expected result is public MyClass(string abcd = default(string))

Swagger-codegen version

3.0.7 (installed via BREW)

Swagger declaration file content or url

https://gist.github.com/Leonardo-Ferreira/9d8b43f85c4f828cdc8ddc4f8f3a4bd3

Command line used for generation

swagger-codegen generate -i http://localhost:51063/swagger/v1/swagger.json -l csharp -o /tmp/cred2

Steps to reproduce

Generate the code, open the src, and check the constructors

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C# generator entry point used by swagger-codegen generate -l csharp and compare its output in the generated src directory with the Swagger declaration linked in the issue. Reproduce the nameless constructor parameters, then verify that generated constructors include the corresponding parameter names and that generation still completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.