Skip to content

Commit b24bc3a

Browse files
davemooreuwstjholm
authored andcommitted
fix: error setting api docs due to nil map
1 parent 04c04ef commit b24bc3a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/stack/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ type Stack struct {
147147
}
148148

149149
func (s *Stack) SetApiDoc(name string, doc *openapi3.T) {
150+
if s.apiDocs == nil {
151+
s.apiDocs = make(map[string]*openapi3.T)
152+
}
153+
150154
s.apiDocs[name] = doc
151155
}
152156

@@ -188,6 +192,10 @@ func FromFile(name string) (*Stack, error) {
188192
if doc, err := openapi3.NewLoader().LoadFromFile(filepath.Join(stack.dir, v)); err != nil {
189193
return nil, err
190194
} else {
195+
if stack.apiDocs == nil {
196+
stack.apiDocs = make(map[string]*openapi3.T)
197+
}
198+
191199
stack.apiDocs[k] = doc
192200
}
193201
}

0 commit comments

Comments
 (0)