@@ -117,7 +117,7 @@ All kubebuilder validation markers must be documented in the field's comment. Fo
117
117
118
118
** Good:**
119
119
``` go
120
- // internalDNSRecords is an optional field that determines whether we deploy
120
+ // internalDNSRecords is an optional field that determines whether we deploy
121
121
// with internal records enabled for api, api-int, and ingress.
122
122
// Valid values are "Enabled" and "Disabled".
123
123
// When set to Enabled, in cluster DNS resolution will be enabled for the api, api-int, and ingress endpoints.
@@ -136,6 +136,43 @@ InternalDNSRecords InternalDNSRecordsType `json:"internalDNSRecords"`
136
136
InternalDNSRecords InternalDNSRecordsType ` json:"internalDNSRecords"`
137
137
```
138
138
139
+ #### Systematic Validation Marker Documentation Checklist
140
+
141
+ ** MANDATORY** : For each field with validation markers, verify the comment documents ALL of the following that apply:
142
+
143
+ ** Field Optionality:**
144
+ - [ ] ` +optional ` - explain behavior when field is omitted
145
+ - [ ] ` +required ` - explain that the field is required
146
+
147
+ ** String/Array Length Constraints:**
148
+ - [ ] ` +kubebuilder:validation:MinLength ` and ` +kubebuilder:validation:MaxLength ` - document character length constraints
149
+ - [ ] ` +kubebuilder:validation:MinItems ` and ` +kubebuilder:validation:MaxItems ` - document item count ranges
150
+
151
+ ** Value Constraints:**
152
+ - [ ] ` +kubebuilder:validation:Enum ` - list all valid enum values and their meanings
153
+ - [ ] ` +kubebuilder:validation:Pattern ` - explain the pattern requirement in human-readable terms
154
+ - [ ] ` +kubebuilder:validation:Minimum ` and ` +kubebuilder:validation:Maximum ` - document numeric ranges
155
+
156
+ ** Advanced Validation:**
157
+ - [ ] ` +kubebuilder:validation:XValidation ` - explain cross-field validation rules in detail
158
+ - [ ] Any custom validation logic - document the validation behavior
159
+
160
+ #### API Review Process
161
+
162
+ ** CRITICAL PROCESS** : Follow this exact order to ensure comprehensive validation:
163
+
164
+ 1 . ** Linting Check** : Run ` make lint ` and fix all kubeapilinter errors first
165
+ 2 . ** Extract Validation Markers** : Use systematic search to find all markers
166
+ 3 . ** Systematic Documentation Review** : For each marker found, verify corresponding documentation exists
167
+ 4 . ** Optional Fields Review** : Ensure every ` +optional ` field explains omitted behavior
168
+ 5 . ** Cross-field Validation** : Verify any documented field relationships have corresponding ` XValidation ` rules
169
+
170
+ ** FAILURE CONDITIONS** : The review MUST fail if any of these are found:
171
+ - Any validation marker without corresponding documentation
172
+ - Any ` +optional ` field without omitted behavior explanation
173
+ - Any documented field constraint without enforcement via validation rules
174
+ - Any ` make lint ` failures
175
+
139
176
The comment must explicitly state:
140
177
- When a field is optional (for ` +kubebuilder:validation:Optional ` or ` +optional ` )
141
178
- Valid enum values (for ` +kubebuilder:validation:Enum ` )
0 commit comments