add comment

This commit is contained in:
Shreyas Goenka 2024-09-09 11:21:09 +02:00
parent 5f48b58366
commit ab3dd7ab96
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 4 additions and 0 deletions

View File

@ -203,6 +203,10 @@ func (c *constructor) walk(typ reflect.Type) (string, error) {
// This function returns all member fields of the provided type.
// If the type has embedded (aka anonymous) fields, this function traverses
// those in a breadth first manner
//
// BFS is important because we want the a field defined at a higher level embedded
// struct to be given preference over a field with the same name defined at a lower
// level embedded struct. For example see: TestHigherLevelEmbeddedFieldIsInSchema
func getStructFields(typ reflect.Type) []reflect.StructField {
fields := []reflect.StructField{}
bfsQueue := list.New()