handle comments in list correctly

This commit is contained in:
Mengqi Yu
2021-06-07 11:29:31 -07:00
parent 732a8522df
commit cabbea0d97
4 changed files with 56 additions and 38 deletions

View File

@@ -54,7 +54,10 @@ func (c *copier) VisitList(s walk.Sources, _ *openapi.ResourceSchema, _ walk.Lis
origin := originItems[i]
if dest.Value == origin.Value {
copy(yaml.NewRNode(dest), yaml.NewRNode(origin))
// We should do it recursively on each node in the list.
if err := CopyComments(yaml.NewRNode(dest), yaml.NewRNode(origin)); err != nil {
return nil, err
}
}
}