-
-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Summary
BindQueryParameterWithOptions and BindRawQueryParameter currently return an error for spaceDelimited and pipeDelimited styles:
case "spaceDelimited", "pipeDelimited":
return fmt.Errorf("query arguments of style '%s' aren't yet supported", style)The serialization side (StyleParamWithLocation) already supports these styles for arrays, but the deserialization side does not. This means generated servers cannot accept parameters that generated clients correctly produce.
Context
This was discovered while auditing parameter binding consistency across all oapi-codegen server templates. When adding spaceDelimited and pipeDelimited query parameters to the test spec in oapi-codegen/internal/test/parameters/, the generated server code correctly passes these styles through to the runtime, but the runtime rejects them.
The fix should be straightforward — these styles only apply to arrays and use different delimiters:
spaceDelimited(explode=false): split on space (%20/+after URL decoding)pipeDelimited(explode=false): split on|
Both with explode=true degenerate to the same behavior as form explode=true (key=val1&key=val2), so only the unexploded case needs new logic.
Affected code
bindparam.goline ~574 (BindQueryParameterWithOptions)bindparam.goline ~770 (BindRawQueryParameter)
References
- OpenAPI 3.0 spec: Parameter Serialization