Skip to content

Bug: Generated c# client methods return voids #3996

@fairking

Description

@fairking

NSwag v13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v11.0.0.0))
Windows 10
.Net6
Visual Studio 2022 Preview 6.0

I was trying to do that via VS (Add Service Reference -> OpenAPI) but it wasn't working. So I simply run the command bellow in powershell (C:\Users\Admin\.nuget\packages\nswag.msbuild\13.15.10\tools\Win\NSwag.exe).

The command:

NSwag.exe openapi2csclient /className:API /namespace:AccessPay /input:{path}swagger.json /output:{path}swaggerClient.cs

The swagger scheme: https://eazycollectservices.github.io/EazyCollectAPIv3/swagger.json

The above example generates not compilable client code:

if (status_ == 200)
{
    return default(void); // Compile error
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions