-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
.NET 8 - Newtonsoft.Json.JsonSerializationException: Error setting value to 'SelectedSwaggerGeneratorRaw' on 'NSwag.Commands.NSwagDocument'. #4659
Comments
After cloning/running nswag locally, it fails on the same line:
Where the key is "WebApiToOpenApiCommand"
Any idea why it is missing |
@jepperaskdk I have the same issue. Do you know what the alternative is for "webApiToOpenApi" in nswag.json? It says: "Removed WebApiToOpenApiCommand: Use the WebApiOpenApiDocumentGenerator to build your own CLI referencing controllers project to generate OpenAPI without starting the app" which links to https://github.com/RicoSuter/NSwag/wiki/WebApiOpenApiDocumentGenerator and there it says it's deprecated and links to https://github.com/RicoSuter/NSwag/wiki/AspNetCoreOpenApiDocumentGenerator where I cannot find any information how to change it. If I remove the documentGenerator from the nswag.json, it will build, but it will generate some random services with the code generator "openApiToTypeScriptClient". When I use "aspNetCoreToOpenApi" for the document configuration it will start so many .NET processes that I will have to restart my computer. I'm confused. Edit: For now it seems to work for me like this, by setting noBuild = true:
But in my case I actually wouldn't need to run Program.cs which it seems to do. I only want to generate the client scripts... |
@Ben555555 I have done the same, and I also experience the same issue with .NET processes being spawned, and as such I have had to disable generating the API clients on build (in csproj). EDIT: Setting It might be a different issue however. For this issue, I suggest to throw a helpful error that "WebApiToOpenApiCommand" is not supported, rather than an obscure uncaught exception. |
I'm encountering a similar issue when migrating from .NET 6 to .NET 8 with NSwag. The error regarding 'WebApiToOpenApiCommand' removal and its alternatives resonates with what I'm experiencing. Have you found any further insights or workarounds since your last comment? I've tried adjusting configurations as suggested but still facing challenges. Any advice or updates on this matter would be greatly appreciated! Thanks in advance." |
14.1.0 NSwag fails to following exception:
csproj:
CHANGED.nswag
Downgrading to 13.20 works as expected |
This bug seem similar to this, however I'm seeing this after upgrading from .NET 6 to .NET 8: #1576
Reproduce on a fresh API with no changes except nswag.json and adding nswag packages of 14.0.0-preview012. See this repository for a reproduce: https://github.com/jepperaskdk/nswagdotnet8
The text was updated successfully, but these errors were encountered: