Skip to content

Commit 1d2abb9

Browse files
committed
refactor(markers): remove Kubebuilder prefix from SSA topology marker constants
Signed-off-by: nayuta-ai <nayuta723@gmail.com>
1 parent 2c2f8cb commit 1d2abb9

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

pkg/analysis/markerscope/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,28 +351,28 @@ func addGeneralMarkers(rules map[string]MarkerScopeRule) {
351351
func addSSATopologyMarkers(rules map[string]MarkerScopeRule) {
352352
ssaMarkers := map[string]MarkerScopeRule{
353353
// Server-Side Apply topology markers
354-
markers.KubebuilderListTypeMarker: {
354+
markers.ListTypeMarker: {
355355
Scope: AnyScope,
356356
NamedTypeConstraint: NamedTypeConstraintRequireTypeDefinition,
357357
TypeConstraint: &TypeConstraint{
358358
AllowedSchemaTypes: []SchemaType{SchemaTypeArray},
359359
},
360360
},
361-
markers.KubebuilderListMapKeyMarker: {
361+
markers.ListMapKeyMarker: {
362362
Scope: AnyScope,
363363
NamedTypeConstraint: NamedTypeConstraintRequireTypeDefinition,
364364
TypeConstraint: &TypeConstraint{
365365
AllowedSchemaTypes: []SchemaType{SchemaTypeArray},
366366
},
367367
},
368-
markers.KubebuilderMapTypeMarker: {
368+
markers.MapTypeMarker: {
369369
Scope: AnyScope,
370370
NamedTypeConstraint: NamedTypeConstraintRequireTypeDefinition,
371371
TypeConstraint: &TypeConstraint{
372372
AllowedSchemaTypes: []SchemaType{SchemaTypeObject},
373373
},
374374
},
375-
markers.KubebuilderStructTypeMarker: {
375+
markers.StructTypeMarker: {
376376
Scope: AnyScope,
377377
TypeConstraint: &TypeConstraint{
378378
AllowedSchemaTypes: []SchemaType{SchemaTypeObject},

pkg/analysis/ssatags/analyzer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (a *analyzer) checkField(pass *analysis.Pass, field *ast.Field, markersAcce
8585

8686
// If the field is a byte array, we cannot use listType markers with it.
8787
if utils.IsByteArray(pass, field) {
88-
listTypeMarkers := fieldMarkers.Get(kubebuildermarkers.KubebuilderListTypeMarker)
88+
listTypeMarkers := fieldMarkers.Get(kubebuildermarkers.ListTypeMarker)
8989
for _, marker := range listTypeMarkers {
9090
pass.Report(analysis.Diagnostic{
9191
Pos: field.Pos(),
@@ -108,7 +108,7 @@ func (a *analyzer) checkField(pass *analysis.Pass, field *ast.Field, markersAcce
108108
return
109109
}
110110

111-
listTypeMarkers := fieldMarkers.Get(kubebuildermarkers.KubebuilderListTypeMarker)
111+
listTypeMarkers := fieldMarkers.Get(kubebuildermarkers.ListTypeMarker)
112112

113113
if len(listTypeMarkers) == 0 {
114114
pass.Report(analysis.Diagnostic{
@@ -146,7 +146,7 @@ func (a *analyzer) checkListTypeMarker(pass *analysis.Pass, listType string, fie
146146
}
147147

148148
func (a *analyzer) checkListTypeMap(pass *analysis.Pass, fieldMarkers markers.MarkerSet, field *ast.Field, qualifiedFieldName string) {
149-
listMapKeyMarkers := fieldMarkers.Get(kubebuildermarkers.KubebuilderListMapKeyMarker)
149+
listMapKeyMarkers := fieldMarkers.Get(kubebuildermarkers.ListMapKeyMarker)
150150

151151
isObjectList := utils.IsObjectList(pass, field)
152152

pkg/markers/markers.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ const (
150150
// KubebuilderItemsXValidationMarker is the marker used to specify CEL validation rules for entries to a nested array type or field in kubebuilder.
151151
KubebuilderItemsXValidationMarker = "kubebuilder:validation:items:XValidation"
152152

153-
// KubebuilderListTypeMarker is the marker used to specify the type of list for server-side apply operations.
154-
KubebuilderListTypeMarker = "listType"
153+
// ListTypeMarker is the marker used to specify the type of list for server-side apply operations.
154+
ListTypeMarker = "listType"
155155

156-
// KubebuilderListMapKeyMarker is the marker used to specify the key field for map-type lists.
157-
KubebuilderListMapKeyMarker = "listMapKey"
156+
// ListMapKeyMarker is the marker used to specify the key field for map-type lists.
157+
ListMapKeyMarker = "listMapKey"
158158

159-
// KubebuilderMapTypeMarker is the marker used to specify the atomicity level of a map.
160-
KubebuilderMapTypeMarker = "mapType"
159+
// MapTypeMarker is the marker used to specify the atomicity level of a map.
160+
MapTypeMarker = "mapType"
161161

162-
// KubebuilderStructTypeMarker is the marker used to specify the atomicity level of a struct.
163-
KubebuilderStructTypeMarker = "structType"
162+
// StructTypeMarker is the marker used to specify the atomicity level of a struct.
163+
StructTypeMarker = "structType"
164164

165165
// KubebuilderSchemaLessMarker is the marker that indicates that a struct is schemaless.
166166
KubebuilderSchemaLessMarker = "kubebuilder:validation:Schemaless"

0 commit comments

Comments
 (0)