mirror of
https://github.com/rancher/steve.git
synced 2025-09-22 03:47:26 +00:00
Update VisitArray
This commit is contained in:
@@ -16,28 +16,17 @@ func (s *schemaFieldVisitor) VisitArray(array *proto.Array) {
|
|||||||
field := definitionField{
|
field := definitionField{
|
||||||
Description: array.GetDescription(),
|
Description: array.GetDescription(),
|
||||||
}
|
}
|
||||||
// this currently is not recursive and provides little information for nested types- while this isn't optimal,
|
// Recursively visit the value subtype
|
||||||
// it was kept this way to provide backwards compat with previous endpoints.
|
subVisitor := &schemaFieldVisitor{definitions: s.definitions}
|
||||||
array.SubType.Accept(s)
|
array.SubType.Accept(subVisitor)
|
||||||
subField := s.field
|
subField := subVisitor.field
|
||||||
|
// Represent the map as "array[<value_type>]"
|
||||||
field.Type = "array[" + subField.Type + "]"
|
field.Type = "array[" + subField.Type + "]"
|
||||||
s.field = field
|
s.field = field
|
||||||
}
|
}
|
||||||
|
|
||||||
// VisitMap turns a map into a definitionField (stored on the receiver). For maps of complex types, will also visit the
|
// VisitMap turns a map into a definitionField (stored on the receiver). For maps of complex types, will also visit the
|
||||||
// subtype.
|
// 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) {
|
func (s *schemaFieldVisitor) VisitMap(protoMap *proto.Map) {
|
||||||
field := definitionField{
|
field := definitionField{
|
||||||
Description: protoMap.GetDescription(),
|
Description: protoMap.GetDescription(),
|
||||||
|
Reference in New Issue
Block a user