1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-19 18:33:59 +00:00

Adjust output to match request in issue, update tests to match reality

This commit is contained in:
Chad Roberts
2025-01-29 07:09:36 -05:00
parent b7afe7bdb3
commit cd74bc3deb
3 changed files with 17 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
package definitions
import (
"fmt"
"k8s.io/kube-openapi/pkg/util/proto"
)
@@ -21,7 +22,7 @@ func (s *schemaFieldVisitor) VisitArray(array *proto.Array) {
array.SubType.Accept(subVisitor)
subField := subVisitor.field
// Represent the map as "array[<value_type>]"
field.Type = "array[" + subField.Type + "]"
field.Type = fmt.Sprintf("array[%s]", subField.Type)
s.field = field
}
@@ -35,8 +36,8 @@ func (s *schemaFieldVisitor) VisitMap(protoMap *proto.Map) {
subVisitor := &schemaFieldVisitor{definitions: s.definitions}
protoMap.SubType.Accept(subVisitor)
subField := subVisitor.field
// Represent the map as "map[string]<value_type>"
field.Type = "map[string]" + subField.Type
// Represent the map as "map[<value_type>]"
field.Type = fmt.Sprintf("map[%s]", subField.Type)
s.field = field
}