refactor: introduce EnumVarMap for improved enum handling across code generators - #24665
Open
Mattias-Sehlstedt wants to merge 2 commits into
Open
refactor: introduce EnumVarMap for improved enum handling across code generators#24665Mattias-Sehlstedt wants to merge 2 commits into
Mattias-Sehlstedt wants to merge 2 commits into
Conversation
Mattias-Sehlstedt
marked this pull request as ready for review
August 10, 2026 10:00
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 30 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Mattias-Sehlstedt
force-pushed
the
enum-map
branch
4 times, most recently
from
August 10, 2026 11:00
76b963c to
cc3987e
Compare
Mattias-Sehlstedt
force-pushed
the
enum-map
branch
from
August 10, 2026 12:18
cc3987e to
889607d
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.
Introduces a enum wrapper model that collects the common operations that are done when creating an enum variable.
This is done as a
HashMapwrapper rather than aCodegenmodel since we want to retain the easy extension of the data. This structure mimics the already existingXMapmodels that are within the model folder.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.
Summary by cubic
Introduces
EnumVarMapto standardize and type-safe enum handling across generators, moving enum constants offCodegenConstantsand replacinggetEnumVarsAsStringwithgetEnumVars. Refactor spans multiple generators with no changes to generated outputs.Refactors
EnumVarMap(HashMap wrapper) with helpers andENUM_*constants.List<EnumVarMap>in core (buildEnumVars, post-processing, extension updates).EnumUtils.getEnumVarsAsString; updated generators toEnumUtils.getEnumVars(C#, Dart, F#, PHP, Python incl. Pydantic V1, Java/Helidon, Go, Nim, OCaml, Haskell, Crystal, Ruby, TypeScript Fetch, Avro, Protobuf, etc.).EnumVarMap, added enum indexes; tests updated to assert booleanisString.Migration
List<EnumVarMap>:buildEnumVars(List<Object>, String)returnsList<EnumVarMap>.updateEnumVarsWithExtensions(...)acceptsList<EnumVarMap>.CodegenConstants.ENUM_*withEnumVarMap.ENUM_*.EnumUtils.getEnumVarsAsString(...)withEnumUtils.getEnumVars(...).EnumVarMapmethods:enumVar(...),setEnumName(...),setEnumValue(...),isString(boolean),getEnumName(),getEnumValue(),isString().Written for commit 889607d. Summary will update on new commits.