Skip to content

Add support for custom Go initialisms in avrogo code generation#149

Open
danieljosephchambers wants to merge 1 commit intoheetch:masterfrom
danieljosephchambers:feature/custom-initialisms
Open

Add support for custom Go initialisms in avrogo code generation#149
danieljosephchambers wants to merge 1 commit intoheetch:masterfrom
danieljosephchambers:feature/custom-initialisms

Conversation

@danieljosephchambers
Copy link
Copy Markdown

Credit to ojcm for the original work (raising the Issue and the PR)
Issue: #126
PR (long since closed): #128

This is basically the same thing as ojcm requested, but based on the current master branch.

Add -goinitialisms and -extrainitialisms flags to the avrogo command to support generating idiomatic Go names with standard initialisms (e.g. UserID instead of User_id) and custom additional initialisms. When -goinitialisms is enabled, the ettle/strcase library is used to produce PascalCase names with correct initialism handling. The default behavior (without flags) is unchanged, preserving backward compatibility. The -extrainitialisms flag accepts a comma-separated list of additional initialisms (e.g. KW,MW,GW) and requires -goinitialisms to be set. The casing logic is applied to both struct field names and enum symbol names via a caser function injected into the generateContext.

Add -goinitialisms and -extrainitialisms flags to the avrogo command
to support generating idiomatic Go names with standard initialisms
(e.g. UserID instead of User_id) and custom additional initialisms.
When -goinitialisms is enabled, the ettle/strcase library is used to
produce PascalCase names with correct initialism handling. The default
behavior (without flags) is unchanged, preserving backward compatibility.
The -extrainitialisms flag accepts a comma-separated list of additional
initialisms (e.g. KW,MW,GW) and requires -goinitialisms to be set.
The casing logic is applied to both struct field names and enum symbol
names via a caser function injected into the generateContext.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant