-
-
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
Error generating typescript #3817
Comments
Have you found a solution for this? For me, it's related to using MomentJS for the dates. Works fine if I use Date. |
No, for me I cannot change that we have a production web app |
Yeah, same here. For the short term, I changed to Date, generated a different file, and then manually merged the relevant parts. |
I have the same problem.
|
Hello. I'm getting the same error. I did some digging, it seems to be related to commit 34eeb97 for issue #1613. The In any case, downgrading to 13.15.9 has been a workaround for me. Edit: And as mentioned above, you need to remove DateTime parameters from the route. |
According to the commit the change was introduced in 13.14.7. Downgrading to 13.15.9 did not solve it and 13.14.5 introduced other problems as the parameters in the url were not replaced anymore. |
same problem with MomentJs, reverting dateTimeType to Date solve the issue |
Any updates on this. Currently MomentJs dateTimeType do not work. |
As a workaround set |
Thanks! Worked for me as well. |
Any Updates? Still I'm facing the issue. The below is my nswag template. { |
Hello with latest NSwag I am getting the bellow error, kindly advise.
Starting web host
System.InvalidOperationException: Error while rendering Liquid template TypeScript/AxiosClient:
System.InvalidOperationException: Error while rendering Liquid template TypeScript/Client.RequestUrl:
System.NullReferenceException: Object reference not set to an instance of an object.
Runtime: Net60
at NSwag.CodeGeneration.TypeScript.Models.TypeScriptParameterModel.get_GetDateTimeToString() in //src/NSwag.CodeGeneration.TypeScript/Models/TypeScriptParameterModel.cs:line 96
at Fluid.Accessors.PropertyInfoAccessor.Invoker
2.Invoke(Object target) at Fluid.Accessors.PropertyInfoAccessor.Get(Object obj, String name, TemplateContext ctx) at Fluid.Values.ObjectValueBase.GetValueAsync(String name, TemplateContext context) at Fluid.Ast.IdentifierSegment.ResolveAsync(FluidValue value, TemplateContext context) at Fluid.Ast.MemberExpression.EvaluateAsync(TemplateContext context) at Fluid.Ast.OutputStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Ast.ElseIfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Ast.IfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Ast.ForStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Parser.FluidTemplate.Awaited(ValueTask
1 task, TextWriter writer, TextEncoder encoder, TemplateContext context, IReadOnlyList1 statements, Int32 startIndex) at Fluid.FluidTemplateExtensions.<RenderAsync>g__Awaited|3_0(ValueTask task, StringWriter writer, StringBuilderPool builder) at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render() ---> System.NullReferenceException: Object reference not set to an instance of an object. at NSwag.CodeGeneration.TypeScript.Models.TypeScriptParameterModel.get_GetDateTimeToString() in /_/src/NSwag.CodeGeneration.TypeScript/Models/TypeScriptParameterModel.cs:line 96 at Fluid.Accessors.PropertyInfoAccessor.Invoker
2.Invoke(Object target)at Fluid.Accessors.PropertyInfoAccessor.Get(Object obj, String name, TemplateContext ctx)
at Fluid.Values.ObjectValueBase.GetValueAsync(String name, TemplateContext context)
at Fluid.Ast.IdentifierSegment.ResolveAsync(FluidValue value, TemplateContext context)
at Fluid.Ast.MemberExpression.EvaluateAsync(TemplateContext context)
at Fluid.Ast.OutputStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.ElseIfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.IfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.ForStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Parser.FluidTemplate.Awaited(ValueTask
1 task, TextWriter writer, TextEncoder encoder, TemplateContext context, IReadOnlyList
1 statements, Int32 startIndex)at Fluid.FluidTemplateExtensions.g__Awaited|3_0(ValueTask task, StringWriter writer, StringBuilderPool builder)
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
--- End of inner exception stack trace ---
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidParser.RenderTemplate(List
1 arguments, TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Parser.ParserTagStatement
1.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)at Fluid.Ast.ForStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.IfStatement.Awaited(ValueTask
1 conditionTask, ValueTask
1 incompleteStatementTask, TextWriter writer, TextEncoder encoder, TemplateContext context, Int32 statementStartIndex)at Fluid.Parser.FluidTemplate.Awaited(ValueTask
1 task, TextWriter writer, TextEncoder encoder, TemplateContext context, IReadOnlyList
1 statements, Int32 startIndex)at Fluid.FluidTemplateExtensions.g__Awaited|3_0(ValueTask task, StringWriter writer, StringBuilderPool builder)
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
---> System.InvalidOperationException: Error while rendering Liquid template TypeScript/Client.RequestUrl:
System.NullReferenceException: Object reference not set to an instance of an object.
at NSwag.CodeGeneration.TypeScript.Models.TypeScriptParameterModel.get_GetDateTimeToString() in //src/NSwag.CodeGeneration.TypeScript/Models/TypeScriptParameterModel.cs:line 96
at Fluid.Accessors.PropertyInfoAccessor.Invoker
2.Invoke(Object target) at Fluid.Accessors.PropertyInfoAccessor.Get(Object obj, String name, TemplateContext ctx) at Fluid.Values.ObjectValueBase.GetValueAsync(String name, TemplateContext context) at Fluid.Ast.IdentifierSegment.ResolveAsync(FluidValue value, TemplateContext context) at Fluid.Ast.MemberExpression.EvaluateAsync(TemplateContext context) at Fluid.Ast.OutputStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Ast.ElseIfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Ast.IfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Ast.ForStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Parser.FluidTemplate.Awaited(ValueTask
1 task, TextWriter writer, TextEncoder encoder, TemplateContext context, IReadOnlyList1 statements, Int32 startIndex) at Fluid.FluidTemplateExtensions.<RenderAsync>g__Awaited|3_0(ValueTask task, StringWriter writer, StringBuilderPool builder) at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render() ---> System.NullReferenceException: Object reference not set to an instance of an object. at NSwag.CodeGeneration.TypeScript.Models.TypeScriptParameterModel.get_GetDateTimeToString() in /_/src/NSwag.CodeGeneration.TypeScript/Models/TypeScriptParameterModel.cs:line 96 at Fluid.Accessors.PropertyInfoAccessor.Invoker
2.Invoke(Object target)at Fluid.Accessors.PropertyInfoAccessor.Get(Object obj, String name, TemplateContext ctx)
at Fluid.Values.ObjectValueBase.GetValueAsync(String name, TemplateContext context)
at Fluid.Ast.IdentifierSegment.ResolveAsync(FluidValue value, TemplateContext context)
at Fluid.Ast.MemberExpression.EvaluateAsync(TemplateContext context)
at Fluid.Ast.OutputStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.ElseIfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.IfStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.ForStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Parser.FluidTemplate.Awaited(ValueTask
1 task, TextWriter writer, TextEncoder encoder, TemplateContext context, IReadOnlyList
1 statements, Int32 startIndex)at Fluid.FluidTemplateExtensions.g__Awaited|3_0(ValueTask task, StringWriter writer, StringBuilderPool builder)
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
--- End of inner exception stack trace ---
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidParser.RenderTemplate(List
1 arguments, TextWriter writer, TextEncoder encoder, TemplateContext context) at Fluid.Parser.ParserTagStatement
1.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)at Fluid.Ast.ForStatement.WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context)
at Fluid.Ast.IfStatement.Awaited(ValueTask
1 conditionTask, ValueTask
1 incompleteStatementTask, TextWriter writer, TextEncoder encoder, TemplateContext context, Int32 statementStartIndex)at Fluid.Parser.FluidTemplate.Awaited(ValueTask
1 task, TextWriter writer, TextEncoder encoder, TemplateContext context, IReadOnlyList
1 statements, Int32 startIndex)at Fluid.FluidTemplateExtensions.g__Awaited|3_0(ValueTask task, StringWriter writer, StringBuilderPool builder)
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
--- End of inner exception stack trace ---
at NJsonSchema.CodeGeneration.DefaultTemplateFactory.LiquidTemplate.Render()
at NJsonSchema.CodeGeneration.CodeArtifact..ctor(String typeName, CodeArtifactType type, CodeArtifactLanguage language, CodeArtifactCategory category, ITemplate template)
at NSwag.CodeGeneration.TypeScript.TypeScriptClientGenerator.GenerateClientTypes(String controllerName, String controllerClassName, IEnumerable
1 operations)+MoveNext() in /_/src/NSwag.CodeGeneration.TypeScript/TypeScriptClientGenerator.cs:line 112 at System.Collections.Generic.List
1.InsertRange(Int32 index, IEnumerable1 collection) at NSwag.CodeGeneration.ClientGeneratorBase
3.GenerateAllClientTypes() in //src/NSwag.CodeGeneration/ClientGeneratorBase.cs:line 117at NSwag.CodeGeneration.ClientGeneratorBase
3.GenerateFile(ClientGeneratorOutputType outputType) in /_/src/NSwag.CodeGeneration/ClientGeneratorBase.cs:line 73 at NSwag.CodeGeneration.ClientGeneratorBase
3.GenerateFile() in //src/NSwag.CodeGeneration/ClientGeneratorBase.cs:line 65at NSwag.Commands.CodeGeneration.SwaggerToTypeScriptClientCommand.b__159_0() in //src/NSwag.Commands/Commands/CodeGeneration/OpenApiToTypeScriptClientCommand.cs:line 418
at NSwag.Commands.CodeGeneration.SwaggerToTypeScriptClientCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/CodeGeneration/OpenApiToTypeScriptClientCommand.cs:line 399
at NSwag.Commands.NSwagDocument.ExecuteAsync() in //src/NSwag.Commands/NSwagDocument.cs:line 85
at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in //src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 85
at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 32
at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in //src/NSwag.Commands/NSwagCommandProcessor.cs:line 61
The text was updated successfully, but these errors were encountered: