Skip to content

fix(httpapi): preserve OpenAPI parameter parity#25291

Merged
kitlangton merged 1 commit into
devfrom
kit/httpapi-parity-sweep
May 2, 2026
Merged

fix(httpapi): preserve OpenAPI parameter parity#25291
kitlangton merged 1 commit into
devfrom
kit/httpapi-parity-sweep

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Preserve legacy OpenAPI parameter schemas for ID-like path/query params in the public HttpApi spec.
  • Tighten bridge coverage so route parameter schema drift is detected, not just parameter presence.
  • Add instance route guidance requiring legacy Hono and Effect HttpApi changes to stay behaviorally aligned.

Validation

  • bun typecheck
  • bun run test test/server/httpapi-bridge.test.ts test/server/httpapi-ui.test.ts
  • bun run test test/server/httpapi-json-parity.test.ts test/server/httpapi-session.test.ts test/server/httpapi-sync.test.ts test/server/httpapi-workspace.test.ts
  • OPENCODE_SDK_OPENAPI=httpapi ./packages/sdk/js/script/build.ts
  • Direct OpenAPI comparison: routes, params, statuses, content types, and request body shapes all match

Notes

  • Generated SDK files were inspected and restored; this PR only changes source, tests, and route guidance.

const PathParameterSchemas = {
sessionID: { type: "string", pattern: "^ses.*" },
messageID: { type: "string", pattern: "^msg.*" },
partID: { type: "string", pattern: "^prt.*" },
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code is awful.

const PathParameterSchemas = {
sessionID: { type: "string", pattern: "^ses.*" },
messageID: { type: "string", pattern: "^msg.*" },
partID: { type: "string", pattern: "^prt.*" },
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow

const override = QueryParameterSchemas[`${route} ${param.name}` as keyof typeof QueryParameterSchemas]
if (override) {
param.schema = override
if (!param.schema || typeof param.schema !== "object") return
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THIS CODE IS HOT GARBAGE. IN A GOOD WAY.

const override = QueryParameterSchemas[`${route} ${param.name}` as keyof typeof QueryParameterSchemas]
if (override) {
param.schema = override
if (!param.schema || typeof param.schema !== "object") return
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sike.

@kitlangton kitlangton marked this pull request as draft May 1, 2026 20:47
@kitlangton kitlangton marked this pull request as ready for review May 1, 2026 20:47
@kitlangton kitlangton marked this pull request as draft May 1, 2026 20:47
@kitlangton kitlangton marked this pull request as ready for review May 1, 2026 20:47
@kitlangton kitlangton merged commit 0b498dd into dev May 2, 2026
17 checks passed
@kitlangton kitlangton deleted the kit/httpapi-parity-sweep branch May 2, 2026 02:18
oleksii-honchar pushed a commit to oleksii-honchar/better-opencode that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant