diff --git a/workflow/source.go b/workflow/source.go index e11358f..2b39429 100644 --- a/workflow/source.go +++ b/workflow/source.go @@ -315,6 +315,8 @@ type FilterOperationsOptions struct { Exclude *bool `yaml:"exclude,omitempty"` } +var transformList = []string{"removeUnused", "filterOperations", "cleanup", "format", "normalize"} + func (t Transformation) Validate() error { numNil := 0 if t.RemoveUnused != nil { @@ -326,8 +328,14 @@ func (t Transformation) Validate() error { if t.Cleanup != nil { numNil++ } + if t.Format != nil { + numNil++ + } + if t.Normalize != nil { + numNil++ + } if numNil != 1 { - return fmt.Errorf("transformation must have exactly one of removeUnused, filterOperations, or cleanup") + return fmt.Errorf("transformation must have exactly one of %s", strings.Join(transformList, ", ")) } if t.FilterOperations != nil { diff --git a/workflow/source_test.go b/workflow/source_test.go index d04265f..64501ea 100644 --- a/workflow/source_test.go +++ b/workflow/source_test.go @@ -344,7 +344,7 @@ func TestSource_Validate(t *testing.T) { }, }, }, - wantErr: fmt.Errorf("failed to validate transformation 0: transformation must have exactly one of removeUnused, filterOperations, or cleanup"), + wantErr: fmt.Errorf("failed to validate transformation 0: transformation must have exactly one of removeUnused, filterOperations, cleanup, format, normalize"), }, { name: "transformations filter success",