@@ -52,7 +52,7 @@ func validatePoolName(name string, fldPath *field.Path) field.ErrorList {
52
52
allErrs = append (allErrs , field .Required (fldPath , "" ))
53
53
} else {
54
54
if len (name ) > resource .PoolNameMaxLength {
55
- allErrs = append (allErrs , field .TooLongMaxLength (fldPath , name , resource .PoolNameMaxLength ))
55
+ allErrs = append (allErrs , field .TooLong (fldPath , "" /*unused*/ , resource .PoolNameMaxLength ))
56
56
}
57
57
parts := strings .Split (name , "/" )
58
58
for _ , part := range parts {
@@ -168,7 +168,7 @@ func validateCELSelector(celSelector resource.CELDeviceSelector, fldPath *field.
168
168
envType = environment .StoredExpressions
169
169
}
170
170
if len (celSelector .Expression ) > resource .CELSelectorExpressionMaxLength {
171
- allErrs = append (allErrs , field .TooLongMaxLength (fldPath .Child ("expression" ), "<value omitted>" , resource .CELSelectorExpressionMaxLength ))
171
+ allErrs = append (allErrs , field .TooLong (fldPath .Child ("expression" ), "" /*unused*/ , resource .CELSelectorExpressionMaxLength ))
172
172
// Don't bother compiling too long expressions.
173
173
return allErrs
174
174
}
@@ -561,7 +561,7 @@ func validateDeviceAttribute(attribute resource.DeviceAttribute, fldPath *field.
561
561
}
562
562
if attribute .StringValue != nil {
563
563
if len (* attribute .StringValue ) > resource .DeviceAttributeMaxValueLength {
564
- allErrs = append (allErrs , field .TooLongMaxLength (fldPath .Child ("string" ), * attribute . StringValue , resource .DeviceAttributeMaxValueLength ))
564
+ allErrs = append (allErrs , field .TooLong (fldPath .Child ("string" ), "" /*unused*/ , resource .DeviceAttributeMaxValueLength ))
565
565
}
566
566
numFields ++
567
567
}
@@ -571,7 +571,7 @@ func validateDeviceAttribute(attribute resource.DeviceAttribute, fldPath *field.
571
571
allErrs = append (allErrs , field .Invalid (fldPath .Child ("version" ), * attribute .VersionValue , "must be a string compatible with semver.org spec 2.0.0" ))
572
572
}
573
573
if len (* attribute .VersionValue ) > resource .DeviceAttributeMaxValueLength {
574
- allErrs = append (allErrs , field .TooLongMaxLength (fldPath .Child ("version" ), * attribute . VersionValue , resource .DeviceAttributeMaxValueLength ))
574
+ allErrs = append (allErrs , field .TooLong (fldPath .Child ("version" ), "" /*unused*/ , resource .DeviceAttributeMaxValueLength ))
575
575
}
576
576
}
577
577
@@ -628,7 +628,7 @@ func validateFullyQualifiedName(name resource.FullyQualifiedName, fldPath *field
628
628
func validateCIdentifier (id string , fldPath * field.Path ) field.ErrorList {
629
629
var allErrs field.ErrorList
630
630
if len (id ) > resource .DeviceMaxIDLength {
631
- allErrs = append (allErrs , field .TooLongMaxLength (fldPath , id , resource .DeviceMaxIDLength ))
631
+ allErrs = append (allErrs , field .TooLong (fldPath , "" /*unused*/ , resource .DeviceMaxIDLength ))
632
632
}
633
633
for _ , msg := range validation .IsCIdentifier (id ) {
634
634
allErrs = append (allErrs , field .TypeInvalid (fldPath , id , msg ))
@@ -649,7 +649,7 @@ func validateSlice[T any](slice []T, maxSize int, validateItem func(T, *field.Pa
649
649
// Dumping the entire field into the error message is likely to be too long,
650
650
// in particular when it is already beyond the maximum size. Instead this
651
651
// just shows the number of entries.
652
- allErrs = append (allErrs , field .TooLongMaxLength (fldPath , len (slice ), maxSize ))
652
+ allErrs = append (allErrs , field .TooMany (fldPath , len (slice ), maxSize ))
653
653
}
654
654
return allErrs
655
655
}
@@ -685,7 +685,7 @@ func stringKey(item string) (string, string) {
685
685
func validateMap [K ~ string , T any ](m map [K ]T , maxSize int , validateKey func (K , * field.Path ) field.ErrorList , validateItem func (T , * field.Path ) field.ErrorList , fldPath * field.Path ) field.ErrorList {
686
686
var allErrs field.ErrorList
687
687
if maxSize >= 0 && len (m ) > maxSize {
688
- allErrs = append (allErrs , field .TooLongMaxLength (fldPath , len (m ), maxSize ))
688
+ allErrs = append (allErrs , field .TooMany (fldPath , len (m ), maxSize ))
689
689
}
690
690
for key , item := range m {
691
691
allErrs = append (allErrs , validateKey (key , fldPath )... )
0 commit comments