Open fquinsol opened 4 years ago
This was the stack trace. Duration: 280 ms
Message:
Test method FDSAPI.Test.GenerateApiClient.GenerateFdsApi threw exception:
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.
at NSwag.CodeGeneration.Models.OperationModelBase`2.get_UnwrappedResultType()
at NSwag.CodeGeneration.CSharp.Models.CSharpOperationModel.get_SyncResultType()
at NSwag.CodeGeneration.CSharp.Models.CSharpOperationModel.get_ResultType()
--- End of inner exception stack trace ---
at DotLiquid.Context.HandleError(Exception ex)
at DotLiquid.Block.RenderAll(List`1 list, Context context, TextWriter result)
at DotLiquid.Block.Render(Context context, TextWriter result)
at DotLiquid.Document.Render(Context context, TextWriter result)
at DotLiquid.Template.RenderInternal(TextWriter result, RenderParameters parameters)
at DotLiquid.Template.Render(TextWriter writer, RenderParameters parameters)
at DotLiquid.Template.Render(RenderParameters parameters)
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render() ---> 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.
Stack Trace:
OperationModelBase`2.get_UnwrappedResultType()
CSharpOperationModel.get_SyncResultType()
CSharpOperationModel.get_ResultType()
--- End of inner exception stack trace ---
Context.HandleError(Exception ex)
Block.RenderAll(List`1 list, Context context, TextWriter result)
Block.Render(Context context, TextWriter result)
Document.Render(Context context, TextWriter result)
Template.RenderInternal(TextWriter result, RenderParameters parameters)
Template.Render(TextWriter writer, RenderParameters parameters)
Template.Render(RenderParameters parameters)
LiquidTemplate.Render()
--- End of inner exception stack trace ---
LiquidTemplate.Render()
CodeArtifact.ctor(String typeName, CodeArtifactType type, CodeArtifactLanguage language, CodeArtifactCategory category, ITemplate template)
CSharpClientGenerator.GenerateClientTypes(String controllerName, String controllerClassName, IEnumerable`1 operations)+MoveNext()
List`1.InsertRange(Int32 index, IEnumerable`1 collection)
ClientGeneratorBase`3.GenerateAllClientTypes()
ClientGeneratorBase`3.GenerateFile(ClientGeneratorOutputType outputType)
ClientGeneratorBase`3.GenerateFile()
GenerateApiClient.GenerateFdsApi(String apifile) line 28
While generating the c# client for an api an exception occurs. I isolated the smallest section of the API that fails and it can bee seen in the attached "sample-api.txt" file (json) The issue appears related to having an example node under the content type section (application/json) without having an schema node. That particular scenario is not flagged as an error is Swagger and the documentation does not point to schema being a mandatory node. sample-api.txt