Skip to content

Commit dd07cd7

Browse files
committed
k8s:optional and k8s:required should be lowercase
1 parent 1901c31 commit dd07cd7

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

pkg/analysis/optionalorrequired/analyzer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ const (
4343
KubebuilderRequiredMarker = "kubebuilder:validation:Required"
4444

4545
// K8sOptionalMarker is the marker that indicates that a field is optional in k8s declarative validation.
46-
K8sOptionalMarker = "k8s:Optional"
46+
K8sOptionalMarker = "k8s:optional"
4747

4848
// K8sRequiredMarker is the marker that indicates that a field is required in k8s declarative validation.
49-
K8sRequiredMarker = "k8s:Required"
49+
K8sRequiredMarker = "k8s:required"
5050
)
5151

5252
func init() {

pkg/analysis/optionalorrequired/testdata/src/a/a.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,44 +43,44 @@ type OptionalOrRequiredTestStruct struct {
4343

4444
// MarkedWithK8sRequiredAndKubeBuilderRequired is a field with both k8s and kubebuilder required markers.
4545
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
46-
// +k8s:Required
46+
// +k8s:required
4747
// +kubebuilder:validation:Required
4848
MarkedWithK8sRequiredAndKubeBuilderRequired string // want "field MarkedWithK8sRequiredAndKubeBuilderRequired should use marker required instead of kubebuilder:validation:Required"
4949

5050
// MarkedWithK8sRequiredAndRequired is a field with both k8s and required markers.
5151
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
52-
// +k8s:Required
52+
// +k8s:required
5353
// +required
5454
MarkedWithK8sRequiredAndRequired string
5555

5656
// MarkedWithK8sOptionalAndKubeBuilderOptional is a field with both k8s and kubebuilder optional markers.
5757
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
58-
// +k8s:Optional
58+
// +k8s:optional
5959
// +kubebuilder:validation:Optional
6060
MarkedWithK8sOptionalAndKubeBuilderOptional string // want "field MarkedWithK8sOptionalAndKubeBuilderOptional should use marker optional instead of kubebuilder:validation:Optional"
6161

6262
// MarkedWithK8sOptionalAndOptional is a field with both k8s and optional markers.
6363
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
64-
// +k8s:Optional
64+
// +k8s:optional
6565
// +optional
6666
MarkedWithK8sOptionalAndOptional string
6767

6868
// MarkedWithK8sOptionalAndRequired is a field with both k8s and required markers.
6969
// The k8s versions of the markers are currently in addition to other markers, but they should match the semantics.
70-
// +k8s:Optional
70+
// +k8s:optional
7171
// +required
72-
MarkedWithK8sOptionalAndRequired string // want "field MarkedWithK8sOptionalAndRequired must not be marked as both k8s:Optional and required"
72+
MarkedWithK8sOptionalAndRequired string // want "field MarkedWithK8sOptionalAndRequired must not be marked as both k8s:optional and required"
7373

7474
// MarkedWithK8sRequiredAndOptional is a field with both k8s and optional markers.
7575
// The k8s versions of the markers are currently in addition to other markers, but they should match the semantics.
76-
// +k8s:Required
76+
// +k8s:required
7777
// +optional
78-
MarkedWithK8sRequiredAndOptional string // want "field MarkedWithK8sRequiredAndOptional must not be marked as both optional and k8s:Required"
78+
MarkedWithK8sRequiredAndOptional string // want "field MarkedWithK8sRequiredAndOptional must not be marked as both optional and k8s:required"
7979

8080
// MarkedWithK8sRequiredAndK8sOptional is a field with both k8s and kubebuilder optional markers.
81-
// +k8s:Required
82-
// +k8s:Optional
83-
MarkedWithK8sRequiredAndK8sOptional string // want "field MarkedWithK8sRequiredAndK8sOptional must be marked as optional or required" "field MarkedWithK8sRequiredAndK8sOptional must not be marked as both k8s:Optional and k8s:Required"
81+
// +k8s:required
82+
// +k8s:optional
83+
MarkedWithK8sRequiredAndK8sOptional string // want "field MarkedWithK8sRequiredAndK8sOptional must be marked as optional or required" "field MarkedWithK8sRequiredAndK8sOptional must not be marked as both k8s:optional and k8s:required"
8484

8585
A `json:",inline"`
8686

pkg/analysis/optionalorrequired/testdata/src/a/a.go.golden

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,44 +38,44 @@ type OptionalOrRequiredTestStruct struct {
3838

3939
// MarkedWithK8sRequiredAndKubeBuilderRequired is a field with both k8s and kubebuilder required markers.
4040
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
41-
// +k8s:Required
41+
// +k8s:required
4242
// +required
4343
MarkedWithK8sRequiredAndKubeBuilderRequired string // want "field MarkedWithK8sRequiredAndKubeBuilderRequired should use marker required instead of kubebuilder:validation:Required"
4444

4545
// MarkedWithK8sRequiredAndRequired is a field with both k8s and required markers.
4646
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
47-
// +k8s:Required
47+
// +k8s:required
4848
// +required
4949
MarkedWithK8sRequiredAndRequired string
5050

5151
// MarkedWithK8sOptionalAndKubeBuilderOptional is a field with both k8s and kubebuilder optional markers.
5252
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
53-
// +k8s:Optional
53+
// +k8s:optional
5454
// +optional
5555
MarkedWithK8sOptionalAndKubeBuilderOptional string // want "field MarkedWithK8sOptionalAndKubeBuilderOptional should use marker optional instead of kubebuilder:validation:Optional"
5656

5757
// MarkedWithK8sOptionalAndOptional is a field with both k8s and optional markers.
5858
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
59-
// +k8s:Optional
59+
// +k8s:optional
6060
// +optional
6161
MarkedWithK8sOptionalAndOptional string
6262

6363
// MarkedWithK8sOptionalAndRequired is a field with both k8s and required markers.
6464
// The k8s versions of the markers are currently in addition to other markers, but they should match the semantics.
65-
// +k8s:Optional
65+
// +k8s:optional
6666
// +required
67-
MarkedWithK8sOptionalAndRequired string // want "field MarkedWithK8sOptionalAndRequired must not be marked as both k8s:Optional and required"
67+
MarkedWithK8sOptionalAndRequired string // want "field MarkedWithK8sOptionalAndRequired must not be marked as both k8s:optional and required"
6868

6969
// MarkedWithK8sRequiredAndOptional is a field with both k8s and optional markers.
7070
// The k8s versions of the markers are currently in addition to other markers, but they should match the semantics.
71-
// +k8s:Required
71+
// +k8s:required
7272
// +optional
73-
MarkedWithK8sRequiredAndOptional string // want "field MarkedWithK8sRequiredAndOptional must not be marked as both optional and k8s:Required"
73+
MarkedWithK8sRequiredAndOptional string // want "field MarkedWithK8sRequiredAndOptional must not be marked as both optional and k8s:required"
7474

7575
// MarkedWithK8sRequiredAndK8sOptional is a field with both k8s and kubebuilder optional markers.
76-
// +k8s:Required
77-
// +k8s:Optional
78-
MarkedWithK8sRequiredAndK8sOptional string // want "field MarkedWithK8sRequiredAndK8sOptional must be marked as optional or required" "field MarkedWithK8sRequiredAndK8sOptional must not be marked as both k8s:Optional and k8s:Required"
76+
// +k8s:required
77+
// +k8s:optional
78+
MarkedWithK8sRequiredAndK8sOptional string // want "field MarkedWithK8sRequiredAndK8sOptional must be marked as optional or required" "field MarkedWithK8sRequiredAndK8sOptional must not be marked as both k8s:optional and k8s:required"
7979

8080
A `json:",inline"`
8181

pkg/analysis/optionalorrequired/testdata/src/c/c.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ type RequiredEnum string // want "type RequiredEnum should not be marked as requ
1818
// +kubebuilder:validation:Enum=Foo;Bar;Baz
1919
type KubeBuilderRequiredEnum string // want "type KubeBuilderRequiredEnum should not be marked as kubebuilder:validation:Required"
2020

21-
// +k8s:Required
21+
// +k8s:required
2222
// +kubebuilder:validation:Enum=Foo;Bar;Baz
23-
type K8sRequiredEnum string // want "type K8sRequiredEnum should not be marked as k8s:Required"
23+
type K8sRequiredEnum string // want "type K8sRequiredEnum should not be marked as k8s:required"
2424

2525
// +optional
2626
// +kubebuilder:validation:Enum=Foo;Bar;Baz
@@ -30,6 +30,6 @@ type OptionalEnum string // want "type OptionalEnum should not be marked as opti
3030
// +kubebuilder:validation:Enum=Foo;Bar;Baz
3131
type KubeBuilderOptionalEnum string // want "type KubeBuilderOptionalEnum should not be marked as kubebuilder:validation:Optional"
3232

33-
// +k8s:Optional
33+
// +k8s:optional
3434
// +kubebuilder:validation:Enum=Foo;Bar;Baz
35-
type K8sOptionalEnum string // want "type K8sOptionalEnum should not be marked as k8s:Optional"
35+
type K8sOptionalEnum string // want "type K8sOptionalEnum should not be marked as k8s:optional"

pkg/analysis/optionalorrequired/testdata/src/c/c.go.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type RequiredEnum string // want "type RequiredEnum should not be marked as requ
1717
type KubeBuilderRequiredEnum string // want "type KubeBuilderRequiredEnum should not be marked as kubebuilder:validation:Required"
1818

1919
// +kubebuilder:validation:Enum=Foo;Bar;Baz
20-
type K8sRequiredEnum string // want "type K8sRequiredEnum should not be marked as k8s:Required"
20+
type K8sRequiredEnum string // want "type K8sRequiredEnum should not be marked as k8s:required"
2121

2222
// +kubebuilder:validation:Enum=Foo;Bar;Baz
2323
type OptionalEnum string // want "type OptionalEnum should not be marked as optional"
@@ -26,4 +26,4 @@ type OptionalEnum string // want "type OptionalEnum should not be marked as opti
2626
type KubeBuilderOptionalEnum string // want "type KubeBuilderOptionalEnum should not be marked as kubebuilder:validation:Optional"
2727

2828
// +kubebuilder:validation:Enum=Foo;Bar;Baz
29-
type K8sOptionalEnum string // want "type K8sOptionalEnum should not be marked as k8s:Optional"
29+
type K8sOptionalEnum string // want "type K8sOptionalEnum should not be marked as k8s:optional"

0 commit comments

Comments
 (0)