Is it possible to generate contract output files targeting .NET using the CLI, and referencing a .nswag file?
Loading the .nswag file in NSwagStudio produces contract file output when Generate Files button is clicked.
Attempting to run the following via the CLI does not generate any file output:
dotnet "C:\Program Files (x86)\Rico Suter\NSwagStudio\NetCore20\dotnet-nswag.dll" run "C:\temp\nswag\test.nswag"
Thanks
You need to specify an output path (on the bottom in the UI)
The contract file (DTO classes only, no client interface) is generated as expected when file generation is executed through Studio. The contractsOutputFilePath, typesToSwagger classNames, and assemblyPaths properties are set in the .nswag file. When executing the following command using the CLI, no contract file is generated:
dotnet "C:\Program Files (x86)\Rico Suter\NSwagStudio\NetCore20\dotnet-nswag.dll" run "C:\temp\nswag\test.nswag"
When output path is specified, a file is generated (Studio and CLI), but the contents are empty:
//----------------------
//
// Generated using the NSwag toolchain v11.14.1.0 (NJsonSchema v9.10.24.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
//
//----------------------
using Models;
namespace
{
#pragma warning disable // Disable all warnings
}
Same thing happens when you click the "Generate Outputs" button with C# Client, but clicking "Generate Files" it does generate the C# classes as a file, but not in the preview window
Most helpful comment
Same thing happens when you click the "Generate Outputs" button with C# Client, but clicking "Generate Files" it does generate the C# classes as a file, but not in the preview window