Skip to content

Commit c9f9f26

Browse files
committed
add test case to check whether the field is ignored correctly
Signed-off-by: sivchari <shibuuuu5@gmail.com>
1 parent 76b71cf commit c9f9f26

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ type MaxLength struct {
8686

8787
StringWithoutMaxLength string // want "field StringWithoutMaxLength must have a maximum length, add kubebuilder:validation:MaxLength marker"
8888
} `json:"struct"`
89+
90+
// +optional
91+
// +kubebuilder:pruning:PreserveUnknownFields
92+
// +kubebuilder:validation:Schemaless
93+
AllOf []JSONSchemaProps `json:"allOf,omitempty"`
8994
}
9095

9196
// StringAlias is a string without a MaxLength.
@@ -105,3 +110,6 @@ type ByteSliceAlias []byte
105110
// ByteSliceAliasWithMaxLength is a byte slice with a MaxLength.
106111
// +kubebuilder:validation:MaxLength:=512
107112
type ByteSliceAliasWithMaxLength []byte
113+
114+
// JSONSchemaProps is a placeholder for the JSON schema properties.
115+
type JSONSchemaProps struct{}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,12 @@ type SSATagsTestSpec struct {
190190
// Byte array with markers - should be ignored even if markers are present
191191
// +listType=atomic
192192
ByteArrayWithMarker []byte `json:"byteArrayWithMarker,omitempty"` // want "ByteArrayWithMarker is a byte array, which does not support the listType marker. Remove the listType marker"
193+
194+
// +optional
195+
// +kubebuilder:pruning:PreserveUnknownFields
196+
// +kubebuilder:validation:Schemaless
197+
AllOf []JSONSchemaProps `json:"allOf,omitempty"`
193198
}
199+
200+
// JSONSchemaProps is a placeholder for the JSON schema properties.
201+
type JSONSchemaProps struct{}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,12 @@ type SSATagsTestSpec struct {
189189

190190
// Byte array with markers - should be ignored even if markers are present
191191
ByteArrayWithMarker []byte `json:"byteArrayWithMarker,omitempty"` // want "ByteArrayWithMarker is a byte array, which does not support the listType marker. Remove the listType marker"
192+
193+
// +optional
194+
// +kubebuilder:pruning:PreserveUnknownFields
195+
// +kubebuilder:validation:Schemaless
196+
AllOf []JSONSchemaProps `json:"allOf,omitempty"`
192197
}
198+
199+
// JSONSchemaProps is a placeholder for the JSON schema properties.
200+
type JSONSchemaProps struct{}

pkg/analysis/ssatags/testdata/src/b/b.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,12 @@ type SSATagsTestSpec struct {
185185
// Byte array with markers - should be ignored even if markers are present
186186
// +listType=atomic
187187
ByteArrayWithMarker []byte `json:"byteArrayWithMarker,omitempty"` // want "ByteArrayWithMarker is a byte array, which does not support the listType marker. Remove the listType marker"
188+
189+
// +optional
190+
// +kubebuilder:pruning:PreserveUnknownFields
191+
// +kubebuilder:validation:Schemaless
192+
AllOf []JSONSchemaProps `json:"allOf,omitempty"`
188193
}
194+
195+
// JSONSchemaProps is a placeholder for the JSON schema properties.
196+
type JSONSchemaProps struct{}

pkg/analysis/ssatags/testdata/src/b/b.go.golden

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,12 @@ type SSATagsTestSpec struct {
184184

185185
// Byte array with markers - should be ignored even if markers are present
186186
ByteArrayWithMarker []byte `json:"byteArrayWithMarker,omitempty"` // want "ByteArrayWithMarker is a byte array, which does not support the listType marker. Remove the listType marker"
187+
188+
// +optional
189+
// +kubebuilder:pruning:PreserveUnknownFields
190+
// +kubebuilder:validation:Schemaless
191+
AllOf []JSONSchemaProps `json:"allOf,omitempty"`
187192
}
188193

194+
// JSONSchemaProps is a placeholder for the JSON schema properties.
195+
type JSONSchemaProps struct{}

0 commit comments

Comments
 (0)