Both inline enums and reusable/declared enums seem to be affected. For enums with type "integer" the generated code:
- Includes
wireName as an integer. wireName can only be a string.
- Has every member name as
numberN
There is a wireNumber argument you can use instead of wireName. However, the generated code doesn't let you get the integer values easily (you can by reaching into the maps created for the serializers) so without member names using the class will be a little unfriendly.
Snippet of problematic generated code:
class Bucket extends EnumClass {
/// Bucket enum
@BuiltValueEnumConst(wireName: 0)
static const Bucket number0 = _$number0;
Spec to reproduce is here. Errors in lib\model\bucket.dart
openapi-generator version: commit 02a8207b91baf36d94e8928ef26ffdb0be0465fc (master as of now)
Command used java -jar openapi-generator-cli-5.0.0-SNAPSHOT.jar generate -g dart-dio -i openapi-enum-test.json -o .\enum-test-client -p pubName=enumtest
Willing to do a PR but need a little direction. Some of the clients make use of x-enum-varnames which is a possibility to give the members useful names.
cc @josh-burton who recently worked on the enums in hopes that he can provide a direction.
Both inline enums and reusable/declared enums seem to be affected. For enums with type
"integer"the generated code:wireNameas an integer.wireNamecan only be a string.numberNThere is a
wireNumberargument you can use instead ofwireName. However, the generated code doesn't let you get the integer values easily (you can by reaching into the maps created for the serializers) so without member names using the class will be a little unfriendly.Snippet of problematic generated code:
Spec to reproduce is here. Errors in
lib\model\bucket.dartopenapi-generator version: commit
02a8207b91baf36d94e8928ef26ffdb0be0465fc(master as of now)Command used
java -jar openapi-generator-cli-5.0.0-SNAPSHOT.jar generate -g dart-dio -i openapi-enum-test.json -o .\enum-test-client -p pubName=enumtestWilling to do a PR but need a little direction. Some of the clients make use of
x-enum-varnameswhich is a possibility to give the members useful names.cc @josh-burton who recently worked on the enums in hopes that he can provide a direction.