Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions ir/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"cmp"
"slices"
"strconv"
"strings"
)

// ParamSample is a value a generated test sets a parameter to, and what the request must then carry for it.
Expand All @@ -17,9 +16,9 @@ type ParamSample struct {
}

// ParamSamples are the query and header parameters of op a generated test can set and then find in the request, each
// with a value to set it to. A query parameter may be a scalar or an array of scalars, which the test sets to one
// item, the same on the wire in every style; a header parameter must be a scalar. Objects, maps and values with no
// plain text form, such as times, are left out.
// with a value to set it to. A query parameter may be a scalar or an array of scalars, named or not, which the test
// sets to one item, the same on the wire in every style; a header parameter must be a scalar. Objects, maps and values
// with no plain text form, such as times, are left out.
func (doc Document) ParamSamples(op Operation) []ParamSample {
var samples []ParamSample

Expand All @@ -29,7 +28,7 @@ func (doc Document) ParamSamples(op Operation) []ParamSample {
switch {
case p.Props != nil, p.MapValue != nil:
case p.Item != nil:
if lit, wire, ok := doc.scalarSample(*p.Item, len(samples)); ok && strings.HasPrefix(p.Type, "[]") {
if lit, wire, ok := doc.scalarSample(*p.Item, len(samples)); ok {
samples = append(samples, ParamSample{Param: p, Literal: p.Type + "{" + lit + "}", Wire: wire})
}
default:
Expand Down
24 changes: 14 additions & 10 deletions testdata/golden/pkg/golden/client.gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading