RicoSuter / NSwag

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

NSwag run command is not working in linux #2444

Open EugeneAzhogin opened 5 years ago

EugeneAzhogin commented 5 years ago

I am generate Client with nswag command line tool in MSBuild. It ignores argument of input nswag-file.

So, command

dotnet "/root/.nuget/packages/nswag.msbuild/13.1.2/build/../tools/NetCore30/dotnet-nswag.dll" run "/home/myproject/extsrv.nswag"

prints in output

Current directory does not contain any .nswag files.

In source code https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs I see following line

if (!string.IsNullOrEmpty(Input) && !Input.StartsWith("/") && !Input.StartsWith("-"))

I suppose, this command cannot be used in linux.

gsacavdm commented 4 years ago

I'm having the same issue. @EugeneAzhogin , what did you end up doing given this issue?

i-sinister commented 4 years ago

As a workaround you can start code generator in the projects folder and give relative path to the nswag document.

cd /home/myproject
dotnet "/root/.nuget/packages/nswag.msbuild/13.1.2/build/../tools/NetCore30/dotnet-nswag.dll" run "./extsrv.nswag"

This also works with msbuils Execs task:

<Exec
    Command="...."
    WorkingDirectory="/home/myproject"
    ConsoleToMsBuild="true"
    IgnoreExitCode="true" />
pacificsharma commented 3 years ago

It will work from frontend node modules. node_modules/.bin/nswag run nswag/service.config.nswag

amithkumarg commented 10 months ago

Will this ever be fixed?

lahma commented 10 months ago

@amithkumarg well will you ever fix this?