Repository navigation
feat(spec): send list-valued query_params as repeated keys - #529
BlueLabelscotch wants to merge 1 commit into
Conversation
|
|
||
| // Priority 3: default body_params / body_fn path. | ||
| qp := evalQueryParams(ctx, ep.QueryParams, true, extraQueryParams) | ||
| qpm := evalQueryParamsMulti(ctx, ep.QueryParams) |
There was a problem hiding this comment.
callEndpointFull passes qpm to the client only when extraHeaders is non-empty; the headerless Get, Post, Put, and Delete helpers receive only the scalar map. A list-valued filter on an ordinary GET or non-paged list therefore goes missing from the URL, and previews of headerless writes also omit the values.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| params[paramName] = result | ||
| } | ||
| } | ||
| single, _ := endpoint.EvalQueryParams(exprEnv, exprs) |
There was a problem hiding this comment.
evalQueryParams now discards list results, so callers that only use this helper—including file-body requests and both legs of get-then-put—omit keys they previously sent as strings. Those branches are described as unchanged, but supplying --file can now silently remove a query parameter from the same command.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| } | ||
| } | ||
| for k, vs := range r.QueryParamsMulti { | ||
| q.Del(k) |
There was a problem hiding this comment.
Applying QueryParamsMulti last makes a spec list override a scalar that ApplyQueryParamsFn or InjectPaging writes later in request assembly, even though those writes previously took precedence over the spec. This can send the spec's filter instead of the callback's value or keep the page index fixed while the CLI advances it. Other locations where this applies: pkg/endpoint/paging.go:74, pkg/registry/endpoint.go:268
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| if list, isList := asList(out); isList { | ||
| var vals []string | ||
| for _, item := range list { | ||
| if s := exprenv.ResultString(item); s != "" { |
There was a problem hiding this comment.
ResultString treats the literal strings <nil> and map[] as empty, so EvalQueryParams drops those values even when they are explicitly supplied as list items. A multi-value search for either string can therefore lose its filter entirely.
Severity: low
🤖 Was this useful? React with 👍 or 👎
Closes #527
A
query_paramsexpression that returns a list is now sent as repeated keys instead of being stringified:client.Request.QueryParamsMulti; it replaces aQueryParamsor path-query value for the same key.listendpoints (BuildRequest) and the default branch ofcallEndpointFull. The file-body, raw-body and get-then-put branches are unchanged.Compatibility: an expression that already yields a list (e.g. an
is_multiflag passed bare) used to be sent as the Go string[a b]; it now becomes repeated keys. Specs thatjoin(...)are unaffected.