From 97278ce62edb06b39649b516423e1522247c7467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20=C3=85gren?= Date: Mon, 7 Aug 2023 14:04:37 +0200 Subject: [PATCH] support FieldName with multiple underscores previously, any fields with more than one underscore would not be correctly converted: > short_filter becomes: shortFilter > a_longer_filter becomes: aLonger this change hopefully fixes that by looking for any amount of underscores rather than just one, so 'a_longer_filter' should now become 'aLongerFilter'. --- netbox/internal/util/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/internal/util/util.go b/netbox/internal/util/util.go index f9867ad6b..9062e5dea 100644 --- a/netbox/internal/util/util.go +++ b/netbox/internal/util/util.go @@ -122,8 +122,8 @@ func FieldNameToStructName(k string) string { split := strings.Split(k, "_") k = split[0] - if len(split) > 1 { - r2 := []rune(split[1]) + for i := 1; i < len(split); i++ { + r2 := []rune(split[i]) r2[0] = unicode.ToUpper(r2[0]) k = k + string(r2) }