RicoSuter / NSwag

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

C# generated code for national weather service is broken #3514

Open AArnott opened 3 years ago

AArnott commented 3 years ago

When using NSwag.exe to generate C# code:

"%userprofile%\.nuget\packages\nswag.msbuild\13.0.5\build\../tools/Win/NSwag.exe" openapi2csclient /className:NationalWeatherService /namespace:MinerForeman /input:C:\git\MinerForeman\src\MinerForeman\OpenAPIs\openapi.json /output:C:\git\MinerForeman\obj\MinerForeman\openapiClient.cs

Where the openapi.json file came from: https://api.weather.gov/openapi.json

Generates C# code including this:

return default(void);

Which produces a number of compiler errors.

This was with the following references:

    <PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="5.0.7">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

    <PackageReference Include="NSwag.ApiDescription.Client" Version="13.11.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
AliveDevil commented 3 years ago

Happens for Ceph OpenAPI definition as well: https://raw.githubusercontent.com/ceph/ceph/pacific/src/pybind/mgr/dashboard/openapi.yaml

PackageReferences:

<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="5.0.9">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NSwag.ApiDescription.Client" Version="13.13.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
StandBackBurrito commented 1 year ago

I am getting methods with commas in the name

public virtual async System.Threading.Tasks.Task<GridpointGeoJson> Gridpoints,Async(NWSForecastOfficeId wfo, int x, int y, System.Threading.CancellationToken cancellationToken)