You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generated code looks like this which is not a valid C# code
publicpartialclassCategories.CategoryClient
{
#pragma warning disable 8618// Set by constructor via BaseUrl propertyprivatestring_baseUrl;
#pragma warning restore 8618// Set by constructor via BaseUrl propertyprivateSystem.Net.Http.HttpClient_httpClient;privatestaticSystem.Lazy<System.Text.Json.JsonSerializerOptions>_settings=newSystem.Lazy<System.Text.Json.JsonSerializerOptions>(CreateSerializerSettings,true);publicCategories.CategoryClient(System.Net.Http.HttpClient httpClient){
BaseUrl ="https://localhost:56908";_httpClient=httpClient;}
Error is probably located in GenerateControllerName method, it should somehow handle special characters, probably the best solution to this would be to use Roslyn apis, something like this using Microsoft.CodeAnalysis.CSharp:
sample swagger.json
code:
generated code looks like this which is not a valid C# code
Error is probably located in GenerateControllerName method, it should somehow handle special characters, probably the best solution to this would be to use Roslyn apis, something like this using
Microsoft.CodeAnalysis.CSharp
:code inspired by this
libraries used:
NJsonSchema.CodeGeneration.CSharp: 11.0.0
NSwag.CodeGeneration.CSharp: 14.0.1
NSwag.Core: 14.0.1
The text was updated successfully, but these errors were encountered: