fix: normalize adapter middleware responses - #163
Open
charlie12520 wants to merge 2 commits into
Open
Conversation
charlie12520
force-pushed
the
charlie/30-adapter-middleware-response-guard
branch
from
May 27, 2026 18:09
2c5ca7f to
4c08b2d
Compare
charlie12520
force-pushed
the
charlie/30-adapter-middleware-response-guard
branch
from
May 27, 2026 18:15
4c08b2d to
9179e92
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Acceptance / contributor review
return { ... }from a route instead ofreturn ctx.json({ ... }), throw an error telling them to usectx.json#30 acceptance surface: unsupported raw route-style returns should produce the actionablectx.json(...)guidance instead of confusing serialization errors.npm run testfor the full suite.Validation
npx ava tests/errors/do-not-allow-raw-json.test.ts-> 7 passed.npx ava tests/errors/do-not-allow-raw-json.test.ts-> 7 passed.npx prettier --check src/types/winter-spec.ts tests/errors/do-not-allow-raw-json.test.ts-> passed.git diff --check-> passed, with only the normal Windows LF-to-CRLF warning.npx tsc --noEmit --pretty false-> blocked by existing OpenAPI/codegen type errors insrc/cli/commands/codegen/openapi.ts,src/cli2/commands/codegen/openapi.ts, andtests/cli/codegen/openapi/openapi-codegen.test.ts.npm test -- tests/errors/do-not-allow-raw-json.test.ts-> blocked during pretest build by the existing OpenAPI operation.responses errors above.Non-overlap check
Before submitting, I checked open PRs for makeRequestAgainstWinterSpec middleware, adapter middleware ctx.json, options.middleware raw object, handle404 ctx.json, and handle404 raw JSON. I did not find an open PR covering these public makeRequest/options.middleware or handle404 paths. PR #162 covers route/auth middleware inside createWithWinterSpec; this patch covers adapter-level middleware and custom 404 handlers passed through makeRequest/adapters.
/claim #30