engine: Don't force validation for hidden resources

I think this is what I want in most scenarios, is there a reason to do
otherwise? This is because we may wish to export incomplete resources,
where the remaining necessary fields for validation happens on collect.
This commit is contained in:
James Shubin
2025-05-06 03:36:01 -04:00
parent 2ee403bab9
commit ad0dd44130
3 changed files with 19 additions and 1 deletions

View File

@@ -154,7 +154,8 @@ type MetaParams struct {
// named resources. It can even be used as part of an edge or via a
// send/recv receiver. It can NOT be a sending vertex. These properties
// differentiate the use of this instead of simply wrapping a resource
// in an "if" statement.
// in an "if" statement. If it is hidden, then it does not need to pass
// the resource Validate method step.
Hidden bool `yaml:"hidden"`
// Export is a list of hostnames (and/or the special "*" entry) which if

View File

@@ -312,6 +312,12 @@ func Validate(res Res) error {
return fmt.Errorf("the Res name starts with a $")
}
// Don't need to validate normally if hidden.
// XXX: Check if it's also Exported too? len(res.MetaParams.Export) > 0
if res.MetaParams().Hidden {
return nil
}
return res.Validate()
}