@@ -57,6 +57,15 @@ func ReadStageFromFile(filePath string) (*Stage, error) {
57
57
if err = json .Unmarshal (bytes , stage ); err != nil {
58
58
return nil , fmt .Errorf ("failed to parse json %s: %w" , filePath , err )
59
59
}
60
+ for i , queryFile := range stage .QueryFiles {
61
+ if ! filepath .IsAbs (queryFile ) {
62
+ queryFile = filepath .Join (stage .BaseDir , queryFile )
63
+ stage .QueryFiles [i ] = queryFile
64
+ }
65
+ if _ , err = os .Stat (queryFile ); err != nil {
66
+ return nil , fmt .Errorf ("%s links to an invalid query file %s: %w" , stage .Id , queryFile , err )
67
+ }
68
+ }
60
69
log .Debug ().Str ("id" , stage .Id ).Str ("path" , filePath ).Msg ("read stage file" )
61
70
return stage , nil
62
71
}
@@ -80,14 +89,6 @@ func ParseStage(stage *Stage, stages Map) (*Stage, error) {
80
89
log .Debug ().Msgf ("%s already parsed, returned" , stage .Id )
81
90
return stageFound , nil
82
91
}
83
- for _ , queryFile := range stage .QueryFiles {
84
- if ! filepath .IsAbs (queryFile ) {
85
- queryFile = filepath .Join (stage .BaseDir , queryFile )
86
- }
87
- if _ , err := os .Stat (queryFile ); err != nil {
88
- return nil , fmt .Errorf ("%s links to an invalid query file %s: %w" , stage .Id , queryFile , err )
89
- }
90
- }
91
92
for i , nextStagePath := range stage .NextStagePaths {
92
93
if ! filepath .IsAbs (nextStagePath ) {
93
94
nextStagePath = filepath .Join (stage .BaseDir , nextStagePath )
0 commit comments