fix(jsontypes): handle hyphenated JSON keys in PascalCase conversion

snakeToPascal now splits on both underscores and hyphens, producing
valid Go identifiers like GenerationI, RubySapphire, BlackWhite instead
of invalid ones like Generation-i, Ruby-sapphire, Black-white.
This commit is contained in:
AJ ONeal 2026-03-08 00:27:58 -07:00
parent e7c6d25bed
commit f2045c7831
No known key found for this signature in database

View File

@ -365,7 +365,9 @@ func isUbiquitousField(name string) bool {
// snakeToPascal converts snake_case or camelCase to PascalCase.
func snakeToPascal(s string) string {
parts := strings.Split(s, "_")
parts := strings.FieldsFunc(s, func(r rune) bool {
return r == '_' || r == '-'
})
for i, p := range parts {
parts[i] = capitalize(p)
}