From 34234eaaf3a573af83cd5b90fed123744948bc36 Mon Sep 17 00:00:00 2001 From: Chad Roberts Date: Mon, 27 Jan 2025 14:05:14 -0500 Subject: [PATCH] Update VisitArray --- pkg/schema/definitions/visitor.go | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/pkg/schema/definitions/visitor.go b/pkg/schema/definitions/visitor.go index e8bf8722..97642f76 100644 --- a/pkg/schema/definitions/visitor.go +++ b/pkg/schema/definitions/visitor.go @@ -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[]" 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(),