Skip to content

Commit 7b84f60

Browse files
authored
Merge pull request #1970 from Adirio/validate-plural
🐛 Validate the plugin flag
2 parents b290147 + 45f69ce commit 7b84f60

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/plugins/golang/options.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,13 @@ func (opts Options) Validate() error {
143143
return fmt.Errorf("invalid Kind: %#v", validationErrors)
144144
}
145145

146-
// TODO: validate plural strings if provided
146+
if opts.Plural != "" {
147+
validationErrors = append(validationErrors, validation.IsDNS1035Label(opts.Plural)...)
148+
149+
if len(validationErrors) != 0 {
150+
return fmt.Errorf("invalid Plural: %#v", validationErrors)
151+
}
152+
}
147153

148154
// Ensure apiVersions for k8s types are empty or valid.
149155
for typ, apiVersion := range map[string]string{

0 commit comments

Comments
 (0)