Skip to content

Commit 0b583ce

Browse files
committed
fixup! Build bool query params as *bool
Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent 26e7653 commit 0b583ce

2 files changed

Lines changed: 1 addition & 10 deletions

File tree

cmd/osgen/emit/build.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,11 @@ func buildParamsTestFrag(op *ir.Operation) *ParamsTestFragment {
231231
}
232232

233233
hasDuration := false
234-
hasBool := false
235234
var cases []ParamTestCase
236235
for _, p := range op.QueryParams {
237236
if p.Kind == ir.ParamDuration {
238237
hasDuration = true
239238
}
240-
if p.Kind == ir.ParamBool {
241-
hasBool = true
242-
}
243239
tc := ParamTestCase{Name: p.WireName}
244240
tc.FieldAssign, tc.WantAssign = paramTestValues(p)
245241
cases = append(cases, tc)
@@ -248,7 +244,6 @@ func buildParamsTestFrag(op *ir.Operation) *ParamsTestFragment {
248244
return &ParamsTestFragment{
249245
TypePrefix: op.TypePrefix,
250246
HasDuration: hasDuration,
251-
HasBool: hasBool,
252247
Cases: cases,
253248
}
254249
}
@@ -263,7 +258,7 @@ func paramTestValues(p ir.QueryParam) (fieldAssign, wantAssign string) {
263258
fieldAssign = fmt.Sprintf("%s: 5 * time.Second", p.GoName)
264259
wantAssign = fmt.Sprintf("%q: %q", p.WireName, "5000ms")
265260
case ir.ParamBool:
266-
fieldAssign = fmt.Sprintf("%s: osapitest.Ptr(true)", p.GoName)
261+
fieldAssign = fmt.Sprintf("%s: func(b bool) *bool { return &b }(true)", p.GoName)
267262
wantAssign = fmt.Sprintf("%q: %q", p.WireName, "true")
268263
case ir.ParamList:
269264
fieldAssign = fmt.Sprintf(`%s: []string{"a", "b"}`, p.GoName)

cmd/osgen/emit/frag_tests.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type ParamTestCase struct {
2323
type ParamsTestFragment struct {
2424
TypePrefix string
2525
HasDuration bool
26-
HasBool bool
2726
Cases []ParamTestCase
2827
}
2928

@@ -35,9 +34,6 @@ func (f *ParamsTestFragment) Imports() []Import {
3534
if f.HasDuration {
3635
imps = append(imps, Import{Path: "time"})
3736
}
38-
if f.HasBool {
39-
imps = append(imps, Import{Path: "github.com/opensearch-project/opensearch-go/v4/osapi/internal/test", Alias: "osapitest"})
40-
}
4137
return imps
4238
}
4339

0 commit comments

Comments
 (0)