address comments

This commit is contained in:
Shreyas Goenka 2024-10-02 20:26:42 +02:00
parent 90f360b08b
commit a737977d6f
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,9 @@ import (
func validateFileFormat(configRoot dyn.Value, filePath string) diag.Diagnostics { func validateFileFormat(configRoot dyn.Value, filePath string) diag.Diagnostics {
for _, resourceDescription := range config.SupportedResources() { for _, resourceDescription := range config.SupportedResources() {
singularName := resourceDescription.SingularName singularName := resourceDescription.SingularName
for _, ext := range []string{fmt.Sprintf(".%s.yml", singularName), fmt.Sprintf(".%s.yaml", singularName)} {
for _, yamlExt := range []string{"yml", "yaml"} {
ext := fmt.Sprintf(".%s.%s", singularName, yamlExt)
if strings.HasSuffix(filePath, ext) { if strings.HasSuffix(filePath, ext) {
return validateSingleResourceDefined(configRoot, ext, singularName) return validateSingleResourceDefined(configRoot, ext, singularName)
} }