1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-22 03:47:26 +00:00

Update VisitArray

This commit is contained in:
Chad Roberts
2025-01-27 14:05:14 -05:00
parent b03e41404c
commit 34234eaaf3

View File

@@ -16,28 +16,17 @@ func (s *schemaFieldVisitor) VisitArray(array *proto.Array) {
field := definitionField{
Description: array.GetDescription(),
}
// this currently is not recursive and provides little information for nested types- while this isn't optimal,
// it was kept this way to provide backwards compat with previous endpoints.
array.SubType.Accept(s)
subField := s.field
// Recursively visit the value subtype
subVisitor := &schemaFieldVisitor{definitions: s.definitions}
array.SubType.Accept(subVisitor)
subField := subVisitor.field
// Represent the map as "array[<value_type>]"
field.Type = "array[" + subField.Type + "]"
s.field = field
}
// VisitMap turns a map into a definitionField (stored on the receiver). For maps of complex types, will also visit the
// subtype.
//func (s *schemaFieldVisitor) VisitMap(protoMap *proto.Map) {
// field := definitionField{
// Description: protoMap.GetDescription(),
// }
// // this currently is not recursive and provides little information for nested types- while this isn't optimal,
// // it was kept this way to provide backwards compat with previous endpoints.
// protoMap.SubType.Accept(s)
// subField := s.field
// field.Type = "map[" + subField.Type + "]"
// s.field = field
//}
func (s *schemaFieldVisitor) VisitMap(protoMap *proto.Map) {
field := definitionField{
Description: protoMap.GetDescription(),