Open thomasjoscht opened 3 years ago
Hey,
I've found two problems:
The build action of file Client.Class.Annotations in NSwag.CodeGeneration.CSharp/Templates is wrong. It is set to nothing instead of "embedded". This must be fixed.
In class OperationModelBase.UnwrappedResultType no check for missing schema exists. In my case the openapi.json is a little bit invalid because of sometimes missing schema definitions. Perhaps this should be fixed for a default to string or void.
Regards Thomas
Hey,
I've a problem with my openapi.json file openapi.zip for a MicroStrategy REST API. During Code generation an error occurs.
System.InvalidOperationException: Error while rendering Liquid template CSharp/Client.Class: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
Runtime: Net50 at NSwag.CodeGeneration.Models.OperationModelBase`2.get_UnwrappedResultType() in C:\projects\nswag\src\NSwag.CodeGeneration\Models\OperationModelBase.cs:line 120 at NSwag.CodeGeneration.CSharp.Models.CSharpOperationModel.get_SyncResultType() in C:\projects\nswag\src\NSwag.CodeGeneration.CSharp\Models\CSharpOperationModel.cs:line 127
Do you have any hint why this happens? Perhaps the file is invalid? Does NSwag have any verbose log oportunities for analyzing this problem? Thx a lot.
Regards Thomas