Skip to content

Commit

Permalink
hof/gen: undo required Filepath in Out files
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed Jun 19, 2023
1 parent 22c0c8a commit 3502680
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/gen/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,13 @@ func (G *Generator) decodeFile(file *File, val cue.Value) error {
return fmt.Errorf("Generator %q got a nil file for decoding", G.Name)
}

// skip any files without filepath's
// some generators do this to exclude a file without removing it from the Out list
if file.Filepath == "" {
return fmt.Errorf("Generator %q got a file with no output 'Filepath' in %# v\n", G.Name, file)
if G.Verbosity > 0 {
fmt.Printf("WARN: Generator %q got a file with no output 'Filepath' in %# v\n", G.Name, file)
}
return nil
}

tcE := file.TemplateContent == ""
Expand Down
2 changes: 1 addition & 1 deletion schema/gen/file.cue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ File: {

// The full path under the output location
// empty implies don't generate, even though it may end up in the out list
Filepath: string
Filepath?: string

//
// One and only one of these next three may be set
Expand Down

0 comments on commit 3502680

Please sign in to comment.