Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/ansible/paramconv/paramconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ func ToSnake(s string) string {
n := ""
iReal := -1

// append underscore (_) as prefix and postfix to isolate special words defined in the wordMapping
s = preprocessWordMapping(s)
// skip special word handling when entire string is all uppercase (no need to check lowercase since all special words are uppercased)
if strings.ToUpper(s) != s {
// append underscore (_) as prefix and postfix to isolate special words defined in the wordMapping
s = preprocessWordMapping(s)
}

for i, v := range s {
iReal++
Expand Down
5 changes: 5 additions & 0 deletions internal/ansible/paramconv/paramconv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ func TestToSnake(t *testing.T) {
args: args{"URLsegressIPsEgressHTTPs"},
want: "_urls_egress_ips_egress_https",
},
{
name: "should not interpret special word when entire word is uppercase",
args: args{"THIS_IS_SKIP_NOT_SK_IP"},
want: "_this_is_skip_not_sk_ip",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down