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
Copy file name to clipboardExpand all lines: pkg/analysis/utils/testdata/src/b/structs.go
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,8 @@ type ZeroValueTestStructs struct {
8
8
StructWithNonOmittedFieldsAndMinPropertiesStructWithNonOmittedFieldsAndMinProperties`json:"structWithOneNonOmittedFieldAndMinProperties,omitempty"`// want "zero value is valid" "validation is complete"
9
9
10
10
StructWithOneNonOmittedFieldAndMinPropertiesStructWithOneNonOmittedFieldAndMinProperties`json:"structWithOneNonOmittedFieldAndMinPropertiesAndOmitEmpty,omitempty"`// want "zero value is not valid" "validation is complete"
11
+
12
+
StructWithOmittedRequiredFieldStructWithOmittedRequiredField`json:"structWithOmittedRequiredField,omitempty"`// want "zero value is not valid" "validation is complete"
11
13
}
12
14
13
15
typeStructWithAllOptionalFieldsstruct {
@@ -61,3 +63,10 @@ type StructWithOneNonOmittedFieldAndMinProperties struct {
61
63
// +optional
62
64
Intint32`json:"int,omitempty"`// want "zero value is valid" "validation is not complete"
63
65
}
66
+
67
+
// Struct with an omitted required field.
68
+
// The zero value of the struct is `{}` which is not valid because it does not satisfy the required marker on the string field.
69
+
typeStructWithOmittedRequiredFieldstruct {
70
+
// +required
71
+
Stringstring`json:"string,omitempty"`// want "zero value is valid" "validation is not complete"
0 commit comments