Skip to content

Commit

Permalink
fix: only add valid nodes to verb children (#1760)
Browse files Browse the repository at this point in the history
fixes #1751

We were hitting the above issue because we were trying to traverse the
schema tree to implicitly export nodes, but were encountering a verb
which added nil values into its children slice.
  • Loading branch information
matt2e authored Jun 13, 2024
1 parent 77a9acc commit e6f360f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backend/schema/verb.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ func (v *Verb) Position() Position { return v.Pos }
func (v *Verb) schemaDecl() {}
func (v *Verb) schemaSymbol() {}
func (v *Verb) schemaChildren() []Node {
children := make([]Node, 2+len(v.Metadata))
children[0] = v.Request
children[1] = v.Response
for i, c := range v.Metadata {
children[i+2] = c
children := []Node{}
if v.Request != nil {
children = append(children, v.Request)
}
if v.Response != nil {
children = append(children, v.Response)
}
for _, c := range v.Metadata {
children = append(children, c)
}
return children
}
Expand Down

0 comments on commit e6f360f

Please sign in to comment.