Skip to content

Commit 45f69ce

Browse files
committed
Validate the plugin flag
Signed-off-by: Adrian Orive Oneca <[email protected]>
1 parent b290147 commit 45f69ce

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)