You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// DVMaxLength exercises the DV marker variants of the maxlength linter.
4
+
// DV-only markers should be accepted without requiring the kubebuilder form.
5
+
typeDVMaxLengthstruct {
6
+
// Only DV maxLength — should NOT lint.
7
+
// +k8s:maxLength=256
8
+
StringWithDVMaxLengthstring
9
+
10
+
// DV maxBytes for a []byte field — should NOT lint.
11
+
// +k8s:maxBytes=512
12
+
ByteSliceWithDVMaxBytes []byte
13
+
14
+
// DV maxItems for an array — should NOT lint.
15
+
// +k8s:maxItems=128
16
+
ArrayWithDVMaxItems []int
17
+
18
+
// DV maxProperties for a map[string]V — should NOT lint.
19
+
// +k8s:maxProperties=64
20
+
MapWithDVMaxPropertiesmap[string]string
21
+
22
+
// Both kubebuilder and DV markers — should NOT lint (either satisfies).
23
+
// +kubebuilder:validation:MaxLength:=256
24
+
// +k8s:maxLength=256
25
+
StringWithBothMarkersstring
26
+
27
+
// Both kubebuilder and DV maxItems — should NOT lint.
28
+
// +kubebuilder:validation:MaxItems:=32
29
+
// +k8s:maxItems=32
30
+
ArrayWithBothMaxItemsMarkers []int
31
+
32
+
// +k8s:enum
33
+
// DV enum marker should exempt the string from requiring a max-length.
34
+
DVEnumStringstring
35
+
36
+
// +k8s:format=date-time
37
+
// DV format:=date-time should exempt the string from requiring a max-length.
38
+
DVDateTimeStringstring
39
+
40
+
// +k8s:format=date
41
+
// DV format:=date should exempt the string from requiring a max-length.
42
+
DVDateStringstring
43
+
44
+
// +k8s:format=duration
45
+
// DV format:=duration should exempt the string from requiring a max-length.
46
+
DVDurationStringstring
47
+
48
+
// No marker on string — SHOULD lint.
49
+
StringWithNoMaxLengthstring// want `field DVMaxLength.StringWithNoMaxLength must have a maximum length, add kubebuilder:validation:MaxLength marker`
50
+
51
+
// No marker on []byte — SHOULD lint.
52
+
ByteSliceWithNoMax []byte// want `field DVMaxLength.ByteSliceWithNoMax must have a maximum length, add kubebuilder:validation:MaxLength marker`
53
+
54
+
// No marker on array — SHOULD lint.
55
+
ArrayWithNoMaxItems []int// want `field DVMaxLength.ArrayWithNoMaxItems must have a maximum items, add kubebuilder:validation:MaxItems marker`
56
+
57
+
// No marker on map[string]V — SHOULD lint.
58
+
MapWithNoMaxPropertiesmap[string]string// want `field DVMaxLength.MapWithNoMaxProperties must have a maximum properties, add kubebuilder:validation:MaxProperties marker`
59
+
60
+
// Non-string-keyed map — should NOT lint.
61
+
// DV +k8s:maxProperties only supports string-keyed maps; linter mirrors this constraint.
62
+
MapWithIntKeymap[int]string
63
+
64
+
// DV maxLength applied to []byte — SHOULD lint.
65
+
// +k8s:maxLength (counts chars) is not the correct DV tag for []byte;
66
+
// +k8s:maxBytes (counts bytes) should be used instead.
67
+
// +k8s:maxLength=256
68
+
ByteSliceWithWrongDVMarker []byte// want `field DVMaxLength.ByteSliceWithWrongDVMarker must have a maximum length, add kubebuilder:validation:MaxLength marker`
69
+
}
70
+
71
+
// StringAliasDVMaxLength is a string type with the DV maxLength marker on the alias.
72
+
// +k8s:maxLength=512
73
+
typeStringAliasDVMaxLengthstring
74
+
75
+
// DVMaxLengthWithAliases exercises DV markers on string-alias array elements.
76
+
typeDVMaxLengthWithAliasesstruct {
77
+
// Array of DV-max-length string aliases — should NOT lint on the element length.
78
+
// +kubebuilder:validation:MaxItems:=64
79
+
AliasArrayWithMaxItems []StringAliasDVMaxLength
80
+
81
+
// Array without MaxItems marker — SHOULD lint.
82
+
AliasArrayWithoutMaxItems []StringAliasDVMaxLength// want `field DVMaxLengthWithAliases.AliasArrayWithoutMaxItems must have a maximum items, add kubebuilder:validation:MaxItems marker`
0 commit comments