Open MirKml opened 2 years ago
@MirKml Did you ever find a solution for this?
@cederstrom No, I think for fixing it's necessary to have good C# .NET knowledge and some understanding of nswag internals. And I haven't.
@RicoSuter I'm having the same issue. Do you have any tips on how to solve this? Thanks!
You could probably drop a custom template into use and add TS ignore via comment syntax maybe:
Having template with same name in configured custom template directory (nswag.json configuration) should allow you to remove some checks. Not ideal, but less invasive change.
I solved this by setting handleReferences
to false
.
"documentGenerator": {
"codeGenerators": {
"openApiToTypeScriptClient": {
"handleReferences": false
...
}
}
}
@cederstrom It seems as good workaround when handleReferences isn't necessary. I will check if I can disable it. Thank you.
With NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) OpenAPI spec with models and arrays is converted to Typescript. It can't be compiled with strict settings. It produces errors
This is the problematic code - in VehiclesInfoResponse.init method
It works when Typescript compiler option
strictNullChecks
is set to false.OpenAPI yaml
nswag configuration
tsconfig - Typescript - 3.9