RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.77k stars 1.29k forks source link

ApiException only generated for the first *.json OpenApiReference #2975

Open SimonCull opened 4 years ago

SimonCull commented 4 years ago

When NSwag.ApiDescription.Client generates the client .cs files it only generates the ApiException partial classes for the first of these.

Example of the CsProj file:

<ItemGroup>

    <OpenApiReference Include="Api1.OpenApi.json" Namespace="Project.Api1Client" />

    <OpenApiReference Include="Api2.OpenApi.json" Namespace="Project.Api2Client" />

    <OpenApiReference Include="Api3.OpenApi.json" Namespace="Project.Api3Client" />

  </ItemGroup>

Both ApiException and ApiException are only generated in Api1.OpenApiClient.cs withing the Project.Api1Client namespace. Both Api2.OpenApiClient.cs and Api3.OpenApiClient.cs do not have ApiException and ApiException in their respective namespaces

SimonCull commented 4 years ago

Potentially a wider .Net issue: here

mwolford commented 2 years ago

The work around posted here: https://github.com/dotnet/aspnetcore/issues/18204#issuecomment-606281714 works.

This problem still happens in VS2022, hoping for a fix some day.