Skip to content

Commit c619f5a

Browse files
committed
fix: load outputs from apis with multiple output paths defined
The vervet config allows both Path and Paths to be defined on the output. This function assumed that only the former was populated so wouldn't return specs if only the latter was populated. This seems like a footgun that will happen again so it would be good to change the types so this doesn't happen again.
1 parent f68e5f0 commit c619f5a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

specs/load.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ func GetOutputSpecs(ctx context.Context, api *config.API) ([]*vervet.Document, e
5656
// lazy operations.
5757
func GetOutputSpecsItr(ctx context.Context, api *config.API) iter.Seq2[*vervet.Document, error] {
5858
return func(yield func(*vervet.Document, error) bool) {
59+
path := api.Output.ResolvePaths()
60+
if len(path) == 0 {
61+
// No output defined for this api
62+
return
63+
}
5964
resource := &config.ResourceSet{
60-
Path: api.Output.Path,
65+
// All output paths should have the same contents
66+
Path: path[0],
6167
}
6268
paths, err := files.LocalFSSource{}.Match(resource)
6369
if err != nil {

0 commit comments

Comments
 (0)