swagger-api/swagger-codegen
View on GitHubEnum values OFF and ON not getting generated properly.
Open
#2,559 opened on Apr 11, 2016
Enhancement: FeatureFeature: Enumhelp wanted
Description
I observed this weird issue today when generating java client using maven codegen plugin, that enum values like OFF and ON are somehow ignored. Lets say in my YAML definition, there is:
laziness:
description: Flag to denote whether laziness should be enabled or disabled.
type: string
enum: [ ON, OFF ]
In the above scenario, no enum type is generated, and the class member laziness have the type String. But, If the definition was as follows:
laziness:
description: Flag to denote whether laziness should be enabled or disabled.
type: string
enum: [ ON, OFF, MEH ]
Codegen generates the enum with just one value - MEH, and the class member is assigned the enum type.
But if I put quotes around them, like:
laziness:
description: Flag to denote whether laziness should be enabled or disabled.
type: string
enum: [ "ON", "OFF", "MEH" ]
All values are included in the generated enum.
I use the latest version of swagger-codegen-maven-plugin, version 2.1.6
PS: It works perfectly when generating from editor.swagger.io