1

Adding this endpoint:

[HttpGet("[action]")] public async ValueTask Test(DateOnly d) { }

Causes NSwag to fail with this error:

Severity Code   Description Project File    Line    Suppression State
Error       NSwag command line tool for .NET Core Net70, toolchain v14.0.2.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))
 Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\john\.nuget\packages\nswag.msbuild\14.0.2\tools\Net70
Executing file 'nswag.json' with variables 'Configuration=Debug,OutputPath=bin\Debug\net7.0\,CSharpOutputPath=C:\StrangeCloud\StrangeCloud.Api\..\StrangeCloud.Service.Client.CSharp\Generated,TypescriptOutputPath=C:\StrangeCloud\StrangeCloud.Api\..\StrangeCloud.Service.Client.Typescript'...
Launcher directory: C:\Users\john\.nuget\packages\nswag.msbuild\14.0.2\tools\Net70
System.InvalidOperationException: Error while rendering Liquid template TypeScript/AxiosClient:
Error while rendering Liquid template TypeScript/Client.RequestUrl:
Object reference not set to an instance of an object.
---> System.InvalidOperationException: Error while rendering Liquid template TypeScript/Client.RequestUrl:
Object reference not set to an instance of an object.
---> 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 78
at Fluid.Accessors.PropertyInfoAccessor.Invoker`2.Invoke(Object target)
...etc...

Removing the endpoint makes it work again. Any idea what I'm doing wrong? NSwag supposedly supports DateTime params.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.