File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
21
21
"path"
22
22
"path/filepath"
23
23
24
+ "github.com/getkin/kin-openapi/openapi3"
24
25
"gopkg.in/yaml.v2"
25
26
)
26
27
@@ -139,6 +140,7 @@ type Stack struct {
139
140
Topics map [string ]interface {} `yaml:"topics,omitempty"`
140
141
Queues map [string ]interface {} `yaml:"queues,omitempty"`
141
142
Schedules map [string ]Schedule `yaml:"schedules,omitempty"`
143
+ apiDocs map [string ]* openapi3.T `yaml:"-"`
142
144
Apis map [string ]string `yaml:"apis,omitempty"`
143
145
Sites map [string ]Site `yaml:"sites,omitempty"`
144
146
EntryPoints map [string ]Entrypoint `yaml:"entrypoints,omitempty"`
@@ -177,6 +179,15 @@ func FromFile(name string) (*Stack, error) {
177
179
stack .Containers [name ] = c
178
180
}
179
181
182
+ // Attempt to populate documents from api file references
183
+ for k , v := range stack .Apis {
184
+ if doc , err := openapi3 .NewLoader ().LoadFromFile (filepath .Join (stack .dir , v )); err != nil {
185
+ return nil , err
186
+ } else {
187
+ stack .apiDocs [k ] = doc
188
+ }
189
+ }
190
+
180
191
return stack , nil
181
192
}
182
193
You can’t perform that action at this time.
0 commit comments