Open Colman opened 2 weeks ago
Looking at the way this is handled, its actually handed to the Dart generator by the base infrastructure. The AbstractDartCodegen class (which comes from the main project) is what loads these in and the reserved words are predefined there. It looks like late
is built in. Perhaps re-log your issue on the main OpenAPIGenerator - feel free to link this ticket as well as I would like to know what they say about it.
Describe the bug When generating an enum that has a value that is a reserved word, the
--reserved-words-mappings
param is ignoredExpected behavior The
--reserved-words-mappings
param should not be ignored for enum valuesTo Reproduce
Run:
Produces the following enum in Dart:
The expected enum in Dart is:
Versions openapi-dart-generator-5.12.jar I believe it still happens in 8.1 since the code still contains the suspected cause
Suspected cause The
toEnumVarName
function calls theescapeReservedWord
function before calling thetoVarName
function. This causes the var name to not be found in the reserved words mappings.Workaround Use
--reserved-words-mappings Late=,Late_=late