Enum values OFF and ON not getting generated properly.
#2 559 ouverte le 11 avr. 2016
Métriques du dépôt
- Stars
- (12 701 stars)
- Métriques de merge PR
- (Aucune PR mergée en 30 j)
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