Skip to content

openapi: spec-compliant parameter serialization with url-template - #354

Closed
RhysSullivan wants to merge 1 commit into
rs/openapi-swagger-parserfrom
rs/openapi-url-template
Closed

RhysSullivan wants to merge 1 commit into
rs/openapi-swagger-parserfrom
rs/openapi-url-template

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Apr 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Rewrites query/path/header/cookie serialization on top of url-template (RFC 6570 reference implementation). Maps OpenAPI style + explode to the matching RFC 6570 operator — form (""/"?"), simple (default), label ("."), matrix (";") — and leaves the exploder to the library.
  • Implements spaceDelimited, pipeDelimited, and deepObject by hand since they're OpenAPI-specific and not in RFC 6570.
  • Adds Cookie-header emission for in: cookie params.
  • Enforces required: true on non-path params and on request bodies; previously these silently produced malformed requests.
  • Query pieces are spliced directly onto the URL path rather than going through HttpClientRequest.setUrlParam — Effect's helper routes through URLSearchParams, which would re-encode pipes, break deepObject, and turn %20 into +.

Why

The old serializer ignored style/explode entirely, so any spec that relied on a non-default form (Stripe's expand/limit, GitHub's labels, anything using matrix or label path params) emitted the wrong wire format and the server either errored or silently dropped the values.

Test plan

  • 12 new tests in parameter-styles.test.ts covering: default form explode, form collapsed, pipeDelimited, spaceDelimited, deepObject, primitive baseline, special-char encoding, path label (.red.green.blue), path matrix (;color=red,green,blue), cookie header, missing required query, missing required body
  • bunx vitest run in packages/plugins/openapi — 48/48 pass
  • bun run typecheck clean

Replace ad-hoc `String(value)` serialization in the OpenAPI invoke path
with RFC 6570 expansion via `url-template` for the styles the spec
covers (simple / label / matrix / form), plus hand-rolled handlers for
the three OpenAPI-only styles (spaceDelimited, pipeDelimited,
deepObject). Respects `explode` in every position.

Also:
- Emit cookie parameters as a single `Cookie:` header (previously
  silently dropped).
- Enforce required query/header/cookie params and required request
  bodies with clear `OpenApiInvocationError` messages at invoke time
  rather than letting malformed requests hit the server.

Fixes the LLM-emits-`?tag=a,b` class of bugs (server sees a single
string), the missing-cookie-on-wire class, and gives us up-front
validation for anything declared required.

Tests: new `parameter-styles.test.ts` asserts the exact bytes on the
wire for each style/explode combo plus the missing-required-param
error paths. 48 tests pass in the openapi package.

RhysSullivan commented Apr 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 20, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud dd5459e Apr 20 2026, 10:21 PM

@pkg-pr-new

pkg-pr-new Bot commented Apr 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor/sdk

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/sdk@354

@executor/plugin-file-secrets

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-file-secrets@354

@executor/plugin-google-discovery

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-google-discovery@354

@executor/plugin-graphql

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-graphql@354

@executor/plugin-keychain

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-keychain@354

@executor/plugin-mcp

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-mcp@354

@executor/plugin-oauth2

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-oauth2@354

@executor/plugin-onepassword

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-onepassword@354

@executor/plugin-openapi

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-openapi@354

@executor/plugin-workos-vault

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-workos-vault@354

executor

npm i https://pkg.pr.new/RhysSullivan/executor@354

commit: dd5459e

@RhysSullivan
RhysSullivan deleted the rs/openapi-url-template branch June 11, 2026 08:01
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