Adjust the code generated for enum types to avoid conflicting with names not reserved by the Flatbuffers IDL#8285
Conversation
cf9549d to
1b39351
Compare
vaind
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
This is quite a breaking change - it would break anyone accessing these properties. Instead, I'd suggest changing the field name in case it conflicts, which would not break anyone because they couldn't have used that name anyway. That is what we do for conflicts with reserved keywords too (see uses of namer_).
…rated classes Fixes google#8052 The Dart code generated for enums includes class properties called 'value', 'values', 'minValue' and 'maxValue'. If the Flatbuffer schema includes enums with these values, the generated code will be invalid. This modifies the Dart generator to rename enum properties if they will conflict with these names (as well as the existing rules to avoid conflicts with Dart keywords)
28f0190 to
8d91a4f
Compare
|
Sorry for the delay getting back to this - it slipped way down my list for a bit. Your criticism about the degree to which this was a breaking change is valid - I've reworked this to set up a second Thanks. |
|
This pull request is stale because it has been open 6 months with no activity. Please comment or label |
|
This pull request was automatically closed due to no activity for 6 months plus the 14 day notice period. |
Fixes #8052
The Flatbuffers IDL allows for enums to have values called
value,values,minValueormaxValue, but if these names are used for values in an enum, the generated Dart code won't compile.This modifies the Dart generator to use
$value,$values,$minValueand$maxValueinstead, so that valid Flatbuffer schemas can be used with Dart