This commit is contained in:
2023-08-09 19:33:50 +03:00
parent 040235f92f
commit f1529c9aac
14 changed files with 80 additions and 24 deletions

View File

@@ -1,9 +1,10 @@
package validators
import (
"github.com/go-playground/validator/v10"
"regexp"
"strings"
"github.com/go-playground/validator/v10"
)
// computeDriverValidator is used to validate Driver field in kvmx86/kvmppc create.
@@ -263,3 +264,11 @@ func strictLooseValidator(fe validator.FieldLevel) bool {
return StringInSlice(fieldValue, strictLooseValues)
}
// name workerGroup must be more 3 symbol
func workerGroupNameValidator(fe validator.FieldLevel) bool {
fieldValue := fe.Field().String()
fieldValue = strings.Trim(fieldValue, " ")
return len(fieldValue) >= 3
}