Skip to content

Commit bcdc8c1

Browse files
committed
cleanup
On-behalf-of: @SAP [email protected] Signed-off-by: Artem Shcherbatiuk <[email protected]>
1 parent 09dbdd3 commit bcdc8c1

File tree

4 files changed

+168
-168
lines changed

4 files changed

+168
-168
lines changed

gateway/resolver/dotted_keys.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package resolver
33
// graphqlToKubernetes converts GraphQL input format to Kubernetes API format
44
// []Label → map[string]string (for CREATE/UPDATE operations)
55
func graphqlToKubernetes(obj any) any {
6-
objMap, ok := obj.(map[string]interface{})
6+
objMap, ok := obj.(map[string]any)
77
if !ok {
88
return obj
99
}
@@ -24,7 +24,7 @@ func graphqlToKubernetes(obj any) any {
2424
// kubernetesToGraphQL converts Kubernetes API format to GraphQL output format
2525
// map[string]string → []Label (for QUERY operations)
2626
func kubernetesToGraphQL(obj any) any {
27-
objMap, ok := obj.(map[string]interface{})
27+
objMap, ok := obj.(map[string]any)
2828
if !ok {
2929
return obj
3030
}
@@ -44,7 +44,7 @@ func kubernetesToGraphQL(obj any) any {
4444

4545
// processMetadataToArrays handles metadata field conversion to arrays
4646
func processMetadataToArrays(metadata any) any {
47-
metadataMap, ok := metadata.(map[string]interface{})
47+
metadataMap, ok := metadata.(map[string]any)
4848
if !ok {
4949
return metadata
5050
}
@@ -59,7 +59,7 @@ func processMetadataToArrays(metadata any) any {
5959

6060
// processMetadataToMaps handles metadata field conversion to maps
6161
func processMetadataToMaps(metadata any) any {
62-
metadataMap, ok := metadata.(map[string]interface{})
62+
metadataMap, ok := metadata.(map[string]any)
6363
if !ok {
6464
return metadata
6565
}
@@ -74,7 +74,7 @@ func processMetadataToMaps(metadata any) any {
7474

7575
// processSpecToArrays handles spec field conversion to arrays
7676
func processSpecToArrays(spec any) any {
77-
specMap, ok := spec.(map[string]interface{})
77+
specMap, ok := spec.(map[string]any)
7878
if !ok {
7979
return spec
8080
}
@@ -93,7 +93,7 @@ func processSpecToArrays(spec any) any {
9393

9494
// processSpecToMaps handles spec field conversion to maps
9595
func processSpecToMaps(spec any) any {
96-
specMap, ok := spec.(map[string]interface{})
96+
specMap, ok := spec.(map[string]any)
9797
if !ok {
9898
return spec
9999
}
@@ -112,7 +112,7 @@ func processSpecToMaps(spec any) any {
112112

113113
// processSelectorToArrays handles spec.selector.matchLabels conversion to arrays
114114
func processSelectorToArrays(selector any) any {
115-
selectorMap, ok := selector.(map[string]interface{})
115+
selectorMap, ok := selector.(map[string]any)
116116
if !ok {
117117
return selector
118118
}
@@ -127,7 +127,7 @@ func processSelectorToArrays(selector any) any {
127127

128128
// processSelectorToMaps handles spec.selector.matchLabels conversion to maps
129129
func processSelectorToMaps(selector any) any {
130-
selectorMap, ok := selector.(map[string]interface{})
130+
selectorMap, ok := selector.(map[string]any)
131131
if !ok {
132132
return selector
133133
}
@@ -142,7 +142,7 @@ func processSelectorToMaps(selector any) any {
142142

143143
// processTemplateToArrays handles spec.template.metadata and spec.template.spec conversion to arrays
144144
func processTemplateToArrays(template any) any {
145-
templateMap, ok := template.(map[string]interface{})
145+
templateMap, ok := template.(map[string]any)
146146
if !ok {
147147
return template
148148
}
@@ -159,7 +159,7 @@ func processTemplateToArrays(template any) any {
159159

160160
// processTemplateToMaps handles spec.template.metadata and spec.template.spec conversion to maps
161161
func processTemplateToMaps(template any) any {
162-
templateMap, ok := template.(map[string]interface{})
162+
templateMap, ok := template.(map[string]any)
163163
if !ok {
164164
return template
165165
}
@@ -176,15 +176,15 @@ func processTemplateToMaps(template any) any {
176176

177177
// mapToArray converts map[string]string to []Label
178178
func mapToArray(value any) any {
179-
valueMap, ok := value.(map[string]interface{})
179+
valueMap, ok := value.(map[string]any)
180180
if !ok {
181181
return value
182182
}
183183

184-
labelArray := make([]map[string]interface{}, 0, len(valueMap))
184+
labelArray := make([]map[string]any, 0, len(valueMap))
185185
for k, v := range valueMap {
186186
if strValue, ok := v.(string); ok {
187-
labelArray = append(labelArray, map[string]interface{}{
187+
labelArray = append(labelArray, map[string]any{
188188
"key": k,
189189
"value": strValue,
190190
})
@@ -195,14 +195,14 @@ func mapToArray(value any) any {
195195

196196
// arrayToMap converts []Label to map[string]string
197197
func arrayToMap(value any) any {
198-
valueArray, ok := value.([]interface{})
198+
valueArray, ok := value.([]any)
199199
if !ok {
200200
return value
201201
}
202202

203203
labelMap := make(map[string]string)
204204
for _, item := range valueArray {
205-
itemMap, ok := item.(map[string]interface{})
205+
itemMap, ok := item.(map[string]any)
206206
if !ok {
207207
continue
208208
}

gateway/resolver/resolver.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (r *Service) ListItems(gvk schema.GroupVersionKind, scope v1.ResourceScope)
130130
items := make([]map[string]any, len(list.Items))
131131
for i, item := range list.Items {
132132
// Convert maps back to label arrays for GraphQL response
133-
convertedItem := kubernetesToGraphQL(item.Object).(map[string]interface{})
133+
convertedItem := kubernetesToGraphQL(item.Object).(map[string]any)
134134
items[i] = convertedItem
135135
}
136136

@@ -222,10 +222,10 @@ func (r *Service) CreateItem(gvk schema.GroupVersionKind, scope v1.ResourceScope
222222

223223
log := r.log.With().Str("operation", "create").Str("kind", gvk.Kind).Logger()
224224

225-
objectInput := p.Args["object"].(map[string]interface{})
225+
objectInput := p.Args["object"].(map[string]any)
226226

227227
// Convert label arrays back to maps for Kubernetes compatibility
228-
convertedInput := graphqlToKubernetes(objectInput).(map[string]interface{})
228+
convertedInput := graphqlToKubernetes(objectInput).(map[string]any)
229229

230230
obj := &unstructured.Unstructured{
231231
Object: convertedInput,
@@ -278,7 +278,7 @@ func (r *Service) UpdateItem(gvk schema.GroupVersionKind, scope v1.ResourceScope
278278
return nil, err
279279
}
280280

281-
objectInput := p.Args["object"].(map[string]interface{})
281+
objectInput := p.Args["object"].(map[string]any)
282282
// Convert label arrays back to maps for Kubernetes compatibility
283283
convertedInput := graphqlToKubernetes(objectInput)
284284
// Marshal the converted input object to JSON to create the patch data

0 commit comments

Comments
 (0)