Skip to content

Support spaceDelimited and pipeDelimited query parameter binding #116

Description

@mromaszewicz

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.go line ~574 (BindQueryParameterWithOptions)
  • bindparam.go line ~770 (BindRawQueryParameter)

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions