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

nswag openapi2csclient generates class twice - compilation error #4845

Open
srad opened this issue Apr 4, 2024 · 1 comment
Open

nswag openapi2csclient generates class twice - compilation error #4845

srad opened this issue Apr 4, 2024 · 1 comment

Comments

@srad
Copy link

srad commented Apr 4, 2024

I just updated from 13.19.0 to 14.0.7 and it seems that the swagger2csclient has been removed.
I switched to openapi2csclient now, but the generated code is vaulty. It generates the client class twice into the same file and hence causes an compilation error.

The command I ran: .\nswag\Net80\dotnet-nswag.exe openapi2csclient /input:http://somewhere:1234/swagger/v1/swagger.json /classname:MyApiClient /namespace:SomeWhere.Clients /output:.\Somewhere\Clients\MyApiClient.cs

here is the generated code. I collapsed everything except of the classes and the entire code is inserted twice:

openapi2csclient_client_generated_twice_2

@j-hap
Copy link

j-hap commented Apr 17, 2024

When you define a single class name, but there are multiple endpoints in the openapi description with overlapping names, those are generated inside the same class, which yields duplicate code, see #2660

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

2 participants