Skip to content

[CSHARP] Duplicate constructor parameters in generated models from Swagger JSON #12538

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

Open
bytrus opened this issue Apr 16, 2025 · 0 comments
Open

Comments

@bytrus
Copy link

bytrus commented Apr 16, 2025

Description:
When generating C# models from the following Swagger JSON:
🔗 https://www.zsrnext.ch/ApiGateway/swagger/1/swagger.json
some generated classes contain constructors with duplicate parameters, resulting in invalid and non-compilable code.

Example:
The following constructor was generated for the class SasisRegisterCareProviderCommonModelsApiGatewayV1ResponsesContractBank:

public SasisRegisterCareProviderCommonModelsApiGatewayV1ResponsesContractBank( SasisRegisterCareProviderCommonModelsApiGatewayV1BankGroup bankGroup = default(SasisRegisterCareProviderCommonModelsApiGatewayV1BankGroup), SasisRegisterCareProviderCommonModelsApiGatewayV1Translation bankGroupTranslations = default(SasisRegisterCareProviderCommonModelsApiGatewayV1Translation), SasisRegisterCareProviderCommonModelsApiGatewayV1BankIidType bankIidType = default(SasisRegisterCareProviderCommonModelsApiGatewayV1BankIidType), SasisRegisterCareProviderCommonModelsApiGatewayV1Translation bankIidTypeTranslations = default(SasisRegisterCareProviderCommonModelsApiGatewayV1Translation), int? iid = default(int?), int? newIid = default(int?), string branchId = default(string), string sicIid = default(string), int? headquarterIid = default(int?), string shortName = default(string), string name = default(string), string postalAccountNumber = default(string), string bic = default(string), SasisRegisterCareProviderCommonModelsApiGatewayV1ResponsesContractContact contact = default(SasisRegisterCareProviderCommonModelsApiGatewayV1ResponsesContractContact), SasisRegisterCareProviderCommonModelsApiGatewayV1BankGroup bankGroup = default(SasisRegisterCareProviderCommonModelsApiGatewayV1BankGroup), // duplicate SasisRegisterCareProviderCommonModelsApiGatewayV1ResponsesContractContact contact = default(SasisRegisterCareProviderCommonModelsApiGatewayV1ResponsesContractContact), // duplicate long? id = default(long?) )
As you can see, both bankGroup and contact are included twice!

Code generated with https://app.swaggerhub.com/
Codgen -> ClientSDK -> CSharp

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