@@ -4,25 +4,27 @@ import "time"
4
4
5
5
type decodeAndValidateRequest struct {
6
6
// BEAWRE : the flag of URLParam should match the const string URLParam
7
- URLParam string `json:"-" path:"url_param" validate:"numeric"`
8
- Text string `json:"text" validate:"max=10"`
9
- DefaultInt int `json:"defaultInt" default:"10.0"` // MATCH /field's type and default value's type mismatch/
10
- DefaultInt2 int `json:"defaultInt" default:"10"`
7
+ URLParam string `json:"-" path:"url_param" validate:"numeric"`
8
+ Text string `json:"text" validate:"max=10"`
9
+ DefaultInt int `json:"defaultInt" default:"10.0"` // MATCH /field's type and default value's type mismatch/
10
+ DefaultInt2 int `json:"defaultInt2" default:"10"`
11
+ // MATCH:12 /unknown option 'inline' in JSON tag/
12
+ DefaultInt3 int `json:"defaultInt2,inline" default:"11"` // MATCH /duplicate tag name: 'defaultInt2'/
11
13
DefaultString string `json:"defaultString" default:"foo"`
12
14
DefaultBool bool `json:"defaultBool" default:"trues"` // MATCH /field's type and default value's type mismatch/
13
- DefaultBool2 bool `json:"defaultBool " default:"true"`
14
- DefaultBool3 bool `json:"defaultBool " default:"false"`
15
+ DefaultBool2 bool `json:"defaultBool2 " default:"true"`
16
+ DefaultBool3 bool `json:"defaultBool3 " default:"false"`
15
17
DefaultFloat float64 `json:"defaultFloat" default:"f10.0"` // MATCH /field's type and default value's type mismatch/
16
- DefaultFloat2 float64 `json:"defaultFloat " default:"10.0"`
18
+ DefaultFloat2 float64 `json:"defaultFloat2 " default:"10.0"`
17
19
MandatoryStruct mandatoryStruct `json:"mandatoryStruct" required:"trues"` // MATCH /required should be 'true' or 'false'/
18
- MandatoryStruct2 mandatoryStruct `json:"mandatoryStruct " required:"true"`
19
- MandatoryStruct4 mandatoryStruct `json:"mandatoryStruct " required:"false"`
20
+ MandatoryStruct2 mandatoryStruct `json:"mandatoryStruct2 " required:"true"`
21
+ MandatoryStruct4 mandatoryStruct `json:"mandatoryStruct4 " required:"false"`
20
22
OptionalStruct * optionalStruct `json:"optionalStruct,omitempty"`
21
23
OptionalQuery string `json:"-" querystring:"queryfoo"`
22
24
optionalQuery string `json:"-" querystring:"queryfoo"` // MATCH /tag on not-exported field optionalQuery/
23
25
// No-reg test for bug https://github.com/mgechev/revive/issues/208
24
- Tiret string `json:"-,"`
25
- BadTiret string `json:"other,"` // MATCH /option can not be empty in JSON tag/
26
+ Tiret string `json:"-,"`
27
+ BadTiret string `json:"other,"` // MATCH /option can not be empty in JSON tag/
26
28
}
27
29
28
30
type RangeAllocation struct {
@@ -57,3 +59,46 @@ type VirtualMachineRelocateSpecDiskLocator struct {
57
59
DiskBackingInfo BaseVirtualDeviceBackingInfo `xml:"diskBackingInfo,omitempty,any"`
58
60
Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,other"` // MATCH /unknown option 'other' in XML tag/
59
61
}
62
+
63
+ type TestDuplicatedXMLTags struct {
64
+ A int `xml:"a"`
65
+ B int `xml:"a"` // MATCH /duplicate tag name: 'a'/
66
+ C int `xml:"c"`
67
+ }
68
+
69
+ type TestDuplicatedBSONTags struct {
70
+ A int `bson:"b"`
71
+ B int `bson:"b"` // MATCH /duplicate tag name: 'b'/
72
+ C int `bson:"c"`
73
+ }
74
+
75
+ type TestDuplicatedYAMLTags struct {
76
+ A int `yaml:"b"`
77
+ B int `yaml:"c"`
78
+ C int `yaml:"c"` // MATCH /duplicate tag name: 'c'/
79
+ }
80
+
81
+ type TestDuplicatedProtobufTags struct {
82
+ A int `protobuf:"varint,name=b"`
83
+ B int `protobuf:"varint,name=c"`
84
+ C int `protobuf:"varint,name=c"` // MATCH /duplicate tag name: 'c'/
85
+ }
86
+
87
+ // test case from
88
+ // sigs.k8s.io/kustomize/api/types/helmchartargs.go
89
+
90
+ type HelmChartArgs struct {
91
+ ChartName string `json:"chartName,omitempty" yaml:"chartName,omitempty"`
92
+ ChartVersion string `json:"chartVersion,omitempty" yaml:"chartVersion,omitempty"`
93
+ ChartRepoURL string `json:"chartRepoUrl,omitempty" yaml:"chartRepoUrl,omitempty"`
94
+ ChartHome string `json:"chartHome,omitempty" yaml:"chartHome,omitempty"`
95
+ ChartRepoName string `json:"chartRepoName,omitempty" yaml:"chartRepoName,omitempty"`
96
+ HelmBin string `json:"helmBin,omitempty" yaml:"helmBin,omitempty"`
97
+ HelmHome string `json:"helmHome,omitempty" yaml:"helmHome,omitempty"`
98
+ Values string `json:"values,omitempty" yaml:"values,omitempty"`
99
+ ValuesLocal map [string ]interface {} `json:"valuesLocal,omitempty" yaml:"valuesLocal,omitempty"`
100
+ ValuesMerge string `json:"valuesMerge,omitempty" yaml:"valuesMerge,omitempty"`
101
+ ReleaseName string `json:"releaseName,omitempty" yaml:"releaseName,omitempty"`
102
+ ReleaseNamespace string `json:"releaseNamespace,omitempty" yaml:"releaseNamespace,omitempty"`
103
+ ExtraArgs []string `json:"extraArgs,omitempty" yaml:"extraArgs,omitempty"`
104
+ }
0 commit comments