test: command api

This commit is contained in:
IliaDenisov
2026-02-11 20:00:32 +03:00
parent 751214e5d0
commit 7c4e2a6f88
5 changed files with 865 additions and 52 deletions
+4 -2
View File
@@ -31,8 +31,10 @@ var productionTypeStringValidator validator.Func = func(fl validator.FieldLevel)
v, ok := fl.Field().Interface().(string)
if ok {
f := fl.Parent().FieldByName(fl.Param())
if s, ok := f.Interface().(string); ok && (s == "SHIP" || s == "SCIENCE") && len(strings.TrimSpace(v)) == 0 {
return false
if f.String() == "SHIP" || f.String() == "SCIENCE" {
if _, ok := util.ValidateTypeName(v); !ok {
return false
}
}
}
return true