Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSHARP] swagger-codegen-cli produces invalid constructors with AllOf #12356

Open
asthomas opened this issue Mar 15, 2024 · 0 comments
Open

[CSHARP] swagger-codegen-cli produces invalid constructors with AllOf #12356

asthomas opened this issue Mar 15, 2024 · 0 comments

Comments

@asthomas
Copy link

Description

The C# client API code generator produces constructors that are wrong in a few ways:

  • Members in the derived class that shadow members in the AllOf class appear twice in the constructor parameters
  • Some constructor parameters in the derived class are missing
  • The base class constructor is missing parameters
  • The call to the base class constructor uses parameters that are not in the parameter list of the derived class constructor
    e.g., public DerivedClass (string a, string b) : BaseClass (a, c)
Swagger-codegen version

swagger-codegen-3.0.52

Swagger declaration file content or url

Attached file is the OpenAPI definition file for YouTrack (https://www.jetbrains.com/youtrack/)
config.json
YouTrack.json

Command line used for generation

export JAVA_HOME="c:\Program Files\Java\jdk-18.0.1.1"
java="c:/Program Files/Java/jdk-18.0.1.1/bin/java"
jar="swagger-codegen-3.0.52\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar"
"$java" -jar $jar generate -i YouTrack.json -o api -l csharp -c config.json

Steps to reproduce
  • Build the API using the above command
  • Open the resulting api/Cogent YouTrack.sln file in Visual Studio 2022
  • Change the target framework in the Cogent.YouTrack project to version 4.6.2
  • Build the solution
  • Look at the constructor for Article in Mode/Article.cs
    • Some arguments are duplicated
    • The "id" argument to the base() constructor is undefined
Related issues/PRs

#11905
#11900

Suggest a fix/enhancement

I have no suggestions. It just appears to be broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant