-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asp.net 6.0 nswag 13.15.5 generates empty cs clients. #3834
Comments
I have forked the project and applied the patch. The build output can be found here (https://github.com/Apollo3zehn/NSwag/actions/runs/1717561743, https://github.com/Apollo3zehn/NSwag/suites/4986122681/artifacts/145780363). The .zip file contains the updated NSwagStudio which now generates the correct output. |
Thank you. I don't think it would be so urgent a matter. @RicoSuter would hopefully merge the pull request soon in the next revision. |
For me it was urgent :-) just wanted to share my workaround. |
Glad to know it helped. |
@Apollo3zehn > I tried your version, I have an infinite loading when I try to generate the typescript file. I have the last version available for Nswag Studio (13.15.5.0), and the generated typescript file is still empty, I thought the fix has been already merged, but I don't why, it seems not working. |
I created a git so you can test the infinite loading: open sln file note: in ApiWithAuthentication.Servers.API.csproj, you can uncomment the last lines to directly execute nswag to generate the typescript file |
@ranouf thanks for your feedback. I have had merged #3814 and the .cs client generation works for me fine now. Only problem left is that app.Run(baseUrl) seems to cause another issue which I need to investigate, https://github.com/Nexusforge/nexus/blob/ea7106d29cdda21e752064c3528a99111abd2f38/src/Nexus/Program.cs#L65). I did not test the typescript client generation. |
@Apollo3zehn let me know when you ll have a new artifact to download. If you want to try typescript generation, you can use my git repo. download the code and open the nswag file at the root, every thing is already configured, just need to push "Generate Files" in nswag studio |
@ranouf Sorry, I have unfortunately no time available to test the typescript client generation. I just wanted to say that with the new version (13.15.7 and I guess 13.15.6 also), the C# client generation is working fine for me (except of the above mentioned |
No pb, I succeeded to find the solution, I needed to add Development as environment on nswag Studio to make it work correctly. |
Hi, I'm using NSwag 13.15.10 and I'm still getting empty .cs and .ts clients if I use the new WebApplicationBuilder (and an empty swagger.json as well). Reverting to the old HostBuilder (with Startup.cs) fixed it for now. For info, we're using the same controllers that we were using on .NET 5, I just switched from Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>());
// etc. to the new var builder = WebApplication.CreateBuilder(args);
// etc. I'm not passing a baseUrl to I'm running the nswag CLI from a Docker container with the following Dockerfile: FROM mcr.microsoft.com/dotnet/sdk:6.0-focal
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN dpkg-reconfigure --frontend noninteractive tzdata
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y nodejs
RUN npm install -g nswag@13.15.0 |
I got my Problem with aspnetcore2openapi generating empty specifications fixed, by passing in the Program args. |
This worked for me, but only after removing the bin and obj folders and rebuilding the project. I am using the CLI ( |
Currently having the issue where the generated client.cs and contract.cs files are generated empty.
Underneath my setup:
using the same nswag.json used in a .net 5.0 version, working correctly.
I only changed runtime
"runtime": "Net60",
Build target:
Content of generated client.cs:
`//----------------------
//
// Generated using the NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
//
//----------------------
#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'
#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ...
#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..."
#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'"
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
namespace MyNamespace
{
using System = global::System;
}
#pragma warning restore 1591
#pragma warning restore 1573
#pragma warning restore 472
#pragma warning restore 114
#pragma warning restore 108
#pragma warning restore 3016`
Any idea?
The text was updated successfully, but these errors were encountered: