Skip to content

Commit

Permalink
fix typescript node default enum (#12633)
Browse files Browse the repository at this point in the history
* Default enum value and type are seperated by .

* classname is added to enum default property
  • Loading branch information
GuyGitzMagen authored Jun 20, 2022
1 parent 7b108c2 commit decb96b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,10 @@ public String toDefaultValue(Schema p) {
}
return def;
}

@Override
public String toEnumDefaultValue(String value, String datatype) {
return datatype + "." + value;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
* {{{.}}}
*/
{{/description}}
'{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
'{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{#defaultValue}} = {{#isEnum}}{{classname}}.{{/isEnum}}{{{.}}}{{/defaultValue}};
{{/vars}}

{{#discriminator}}
Expand Down

0 comments on commit decb96b

Please sign in to comment.