Skip to content

fix(client): keep form-style CSV separators literal in query strings - #107

Merged
tanmaykm merged 2 commits into
release-0.2from
tan/csv-form-params
Aug 29, 2026
Merged

fix(client): keep form-style CSV separators literal in query strings#107
tanmaykm merged 2 commits into
release-0.2from
tan/csv-form-params

Conversation

@tanmaykm

Copy link
Copy Markdown
Member

The OAS form style (RFC6570 form-style expansion) serializes a non-exploded array as ?color=blue,black,brown — the separator comma stays literal while the items are percent-encoded (Style Examples table, identical in OAS 3.0.4/3.1.1/3.2.0). This client escaped the fully joined query value instead, producing status=pending%2Csold, which spec-compliant servers — including OpenAPI.jl 1.x generated servers, which split on literal commas so that escaped commas inside items survive — read as a single item containing commas and reject.

The query string is now built by percent-encoding each comma-separated segment individually:

  • form-style CSV separators stay literal (status=pending,sold),
  • spaceDelimited/pipeDelimited separators become %20/%7C, as the specification requires for those styles,
  • a comma in a scalar value stays literal, which is valid per RFC3986 and percent-decodes identically on any server.

Existing 0.2 servers are unaffected: they percent-decode before splitting, so literal separators decode the same way. The fix is in the runtime, so existing generated clients pick it up without regeneration.

Note for reviewers: the fix deliberately lives at query assembly (query_string in do_request), not in set_param — generated code also routes header parameters through set_param without passing location, so escaping there would corrupt header values.

Validation: full test suite with live servers passes (3080 tests); new unit testset in test/param_deserialize.jl covering CSV separators, per-item encoding, %20/%7C delimiters, scalars, and key escaping. Verified live against an OpenAPI.jl 1.x generated petstore server, where multi-value CSV query parameters from this client previously failed with 400 (GET /pet/findByStatus?status=pending,sold).

Suggest tagging v0.2.9 after merge. Part of the pre-1.0 interop work tracked in #104.

The OAS form style (RFC6570 form-style expansion) serializes a
non-exploded array as ?color=blue,black,brown — the separator comma stays
literal while the items are percent-encoded (Style Examples table, OAS
3.0.4/3.1.1/3.2.0). The client escaped the fully joined query value
instead, turning separators into %2C, which spec-compliant servers
(including OpenAPI.jl 1.0 generated servers) read as a single item
containing commas and reject.

Build the query string by percent-encoding each comma-separated segment
individually: form-style CSV separators stay literal, spaceDelimited and
pipeDelimited separators become %20/%7C as the specification requires,
and a comma in a scalar value stays literal, which is valid per RFC3986
and percent-decodes identically. Existing 0.2 servers are unaffected:
they percent-decode before splitting, so literal separators decode the
same way.

Verified against the full test suite with live servers (3080 tests) and
live against an OpenAPI.jl 1.0 generated server, where multi-value CSV
query parameters from this client previously failed with 400.
@tanmaykm
tanmaykm merged commit fd56cf7 into release-0.2 Aug 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant