Skip to content

Commit

Permalink
Skip if it is not a manifest field
Browse files Browse the repository at this point in the history
  • Loading branch information
iamhopaul123 committed Oct 5, 2021
1 parent 45bd195 commit 06e827a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/pkg/manifest/validate_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"testing"

"github.com/aws/copilot-cli/internal/pkg/manifest"
"github.com/aws/copilot-cli/internal/pkg/template"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -69,16 +68,17 @@ func isValid(v reflect.Value) error {
}
var val validator
validatorType := reflect.TypeOf(&val).Elem()
// template.Parser is not a manifest struct.
var tpl template.Parser
templaterType := reflect.TypeOf(&tpl).Elem()
if !typ.Implements(templaterType) && !typ.Implements(validatorType) {
if !typ.Implements(validatorType) {
return fmt.Errorf(`%v does not implement "Validate()"`, typ)
}
if typ.Kind() != reflect.Struct {
return nil
}
for i := 0; i < v.NumField(); i++ {
for i := 0; i < typ.NumField(); i++ {
// Skip if it is not a manifest yaml field.
if string(typ.Field(i).Tag) == "" {
continue
}
if err := isValid(v.Field(i)); err != nil {
return err
}
Expand Down

0 comments on commit 06e827a

Please sign in to comment.