@@ -57,6 +57,15 @@ func ReadStageFromFile(filePath string) (*Stage, error) {
5757 if err = json .Unmarshal (bytes , stage ); err != nil {
5858 return nil , fmt .Errorf ("failed to parse json %s: %w" , filePath , err )
5959 }
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+ }
6069 log .Debug ().Str ("id" , stage .Id ).Str ("path" , filePath ).Msg ("read stage file" )
6170 return stage , nil
6271}
@@ -80,14 +89,6 @@ func ParseStage(stage *Stage, stages Map) (*Stage, error) {
8089 log .Debug ().Msgf ("%s already parsed, returned" , stage .Id )
8190 return stageFound , nil
8291 }
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- }
9192 for i , nextStagePath := range stage .NextStagePaths {
9293 if ! filepath .IsAbs (nextStagePath ) {
9394 nextStagePath = filepath .Join (stage .BaseDir , nextStagePath )
0 commit comments