refactor(dart): align enum description field name with the DefaultCodegen - #24506
Merged
wing328 merged 1 commit intoJul 29, 2026
Merged
Conversation
Mattias-Sehlstedt
force-pushed
the
align-dart-enum-description
branch
from
July 28, 2026 09:05
c76725c to
0dfcbea
Compare
Mattias-Sehlstedt
force-pushed
the
align-dart-enum-description
branch
from
July 28, 2026 09:25
0dfcbea to
a764872
Compare
Mattias-Sehlstedt
marked this pull request as ready for review
July 28, 2026 09:50
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 27 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Mattias-Sehlstedt
force-pushed
the
align-dart-enum-description
branch
from
July 28, 2026 10:18
a764872 to
c83802e
Compare
Mattias-Sehlstedt
force-pushed
the
align-dart-enum-description
branch
from
July 28, 2026 11:09
c83802e to
38796f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes how enum descriptions are handled in Dart, and aligns the behavior with the
DefaultCodegen.The behavioral change is that we look for
enumDescriptionrather thandescriptioninallowableValues->enumVars. This can unexpectedly affect a consumer that redefines the template, since now the codegen will exposeenumDescriptionrather thandescription. The fallback is the update the local template to also useenumDescription.The change from description to enumDescription also ensures that the enum's own description is not leaked to each enum item. This occurs now when the enum items do not have a description themselves, which in turn makes the mustache parses look further up the tree for a value (and thus find the CodegenModel's
description). An enum like the one below is an example that would leak the description.I have instead aligned all Dart enum classes so that they place the schema description once on the class itself instead. This behavior already exists on some enums.
The interpretation of the vendor extension
x-enum-valueshave also been extracted to the EnumUtils since it is a format that comes from Bungie, and it might be of interest to use in otherCodegenstoo. See for example #1486.PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Dart commitee:
@jaumard (2018/09) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)
Summary by cubic
Aligns Dart enum descriptions with
DefaultCodegen: enum items now exposeenumDescription, and the schemadescriptionis emitted once on the enum type. Standardizes Bungiex-enum-valueshandling and updates templates, tests, and samples.Refactors
enumDescriptionfor item docs and render the enum’sdescriptiononce at the type.x-enum-valuesparsing inEnumUtils(BUNGIE_X_ENUM_VALUES,getBungieEnumValues) and use it inAbstractDartCodegen; tests and samples updated to expectenumDescription.Migration
descriptionwithenumDescription.Written for commit 38796f6. Summary will update on new commits.