@@ -69,7 +69,7 @@ func SetJSONCaseStyle(name string, style string, idUppercase bool) string {
69
69
case "camel" :
70
70
return toJsonCamelCase (name , idUppercase )
71
71
case "pascal" :
72
- return toPascalCase (name )
72
+ return toJsonPascalCase (name , idUppercase )
73
73
case "snake" :
74
74
return toSnakeCase (name )
75
75
default :
@@ -95,6 +95,9 @@ func toCamelCase(s string) string {
95
95
func toPascalCase (s string ) string {
96
96
return toCamelInitCase (s , true )
97
97
}
98
+ func toJsonPascalCase (s string , idUppercase bool ) string {
99
+ return toJsonCamelInitCase (s , true , idUppercase )
100
+ }
98
101
99
102
func toCamelInitCase (name string , initUpper bool ) string {
100
103
out := ""
@@ -113,6 +116,10 @@ func toCamelInitCase(name string, initUpper bool) string {
113
116
}
114
117
115
118
func toJsonCamelCase (name string , idUppercase bool ) string {
119
+ return toJsonCamelInitCase (name , false , idUppercase )
120
+ }
121
+
122
+ func toJsonCamelInitCase (name string , initUpper bool , idUppercase bool ) string {
116
123
out := ""
117
124
idStr := "Id"
118
125
@@ -121,7 +128,7 @@ func toJsonCamelCase(name string, idUppercase bool) string {
121
128
}
122
129
123
130
for i , p := range strings .Split (name , "_" ) {
124
- if i == 0 {
131
+ if ! initUpper && i == 0 {
125
132
out += p
126
133
continue
127
134
}
0 commit comments