Open
Description
Description
When generating enums from the swagger definition, null options get turned into string instead of staying plain null. The issue is when i select the null option it actually a string and not null thus i can't send it to the backend w/o setting it to null.
openapi-generator version
5.0.0
OpenAPI declaration file content or url
"reason": {
"type": "string",
"enum": [
"one",
"two",
null
],
"nullable": true
},
Steps to reproduce
run generator with swagger file containing the enum above
openapi-generator-cli generate -g typescript-angular -o ./openapi --additional-properties disallowAdditionalPropertiesIfNotPresent=false,ngVersion=10.2.4,fileNaming=kebab-case -i
This should produce an enum like
export type ReasonEnum = 'one' | 'two' | 'null';
export const ReasonEnum = {
One: 'one' as ReasonEnum,
Two: 'two' as ReasonEnum,
Null: 'null' as ReasonEnum
};
Related issues/PRs
a similar bug has bin reported back in 2019 #1997
Suggest a fix
The produced enum should convert null like (not a string, just plain null)
Null: null as ReasonEnum