From 35c379357933be3df776548e799a49ae2351f2ff Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 18 Jan 2023 17:45:53 +0100 Subject: [PATCH] corrected add to get in getStructFields --- bundle/schema/schema.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundle/schema/schema.go b/bundle/schema/schema.go index ae716600f..14bfc1c15 100644 --- a/bundle/schema/schema.go +++ b/bundle/schema/schema.go @@ -165,7 +165,8 @@ func safeToSchema(golangType reflect.Type, docs *Docs, debugTraceId string, seen // // params: // fields: slice to which member fields of golangType will be added to -func addStructFields(fields []reflect.StructField, golangType reflect.Type) []reflect.StructField { +func getStructFields(golangType reflect.Type) []reflect.StructField { + fields := []reflect.StructField{} bfsQueue := list.New() for i := 0; i < golangType.NumField(); i++ { @@ -256,8 +257,7 @@ func toSchema(golangType reflect.Type, docs *Docs, seenTypes map[reflect.Type]st properties := map[string]*Schema{} required := []string{} if golangType.Kind() == reflect.Struct { - children := []reflect.StructField{} - children = addStructFields(children, golangType) + children := getStructFields(golangType) for _, child := range children { // get child json tags childJsonTag := strings.Split(child.Tag.Get("json"), ",")