Closed nycdotnet closed 11 months ago
I am preparing a fix that overrides GetEnumDefaultValue
in TypeScriptValueGenerator
and changes the behavior if something like the below is true:
typeResolver is TypeScriptTypeResolver tsr && tsr.Settings.EnumStyle == TypeScriptEnumStyle.StringLiteral
Hooray! I can confirm that upgrading NSwag.MSBuild
to the latest preview (14.0.0-preview008
) fixes our TypeScript generation issue!
I am generating TypeScript code for an API with a MyClass schema defined like this:
I am generating with
/enumStyle:StringLiteral
. This will correctly generate the type for myProperty which looks like this:However, when the default is used within the
init
method ofMyClass
, it still tries to use enum syntax which gives an error:I think this was just an oversight during the implementation of #1137 . I am going to attempt to address this.