Skip to content

feat(server, openapi)!: rewrite ORPCHandler, OpenAPIHandler#74

Merged
dinwwwh merged 12 commits intomainfrom
feat/server-openapi/handler-shouldnt-handle-mismatch-error
Jan 6, 2025
Merged

feat(server, openapi)!: rewrite ORPCHandler, OpenAPIHandler#74
dinwwwh merged 12 commits intomainfrom
feat/server-openapi/handler-shouldnt-handle-mismatch-error

Conversation

@dinwwwh
Copy link
Copy Markdown
Member

@dinwwwh dinwwwh commented Jan 5, 2025

This PR removes the handling of the NO_MATCH_PROCEDURE case entirely from the handler. Additionally, it eliminates the CompositeHandler as it represents a poor design pattern.

const { matched, response } = await openAPIHandler.handle(request, { prefix: '/api' })

if (matched) {
  return response
}

// Your custom logic here (e.g., calling `next()` in Express.js or Hono.js)

return new Response('Not found', { status: 404 })

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orpc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 6, 2025 8:41am

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 5, 2025

Open in Stackblitz

More templates

@orpc/client

npm i https://pkg.pr.new/@orpc/client@74

@orpc/next

npm i https://pkg.pr.new/@orpc/next@74

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@74

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@74

@orpc/react

npm i https://pkg.pr.new/@orpc/react@74

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@74

@orpc/server

npm i https://pkg.pr.new/@orpc/server@74

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@74

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@74

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@74

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@74

commit: a4f2a2d

@dinwwwh
Copy link
Copy Markdown
Member Author

dinwwwh commented Jan 5, 2025

Still has a problem with express.js middleware.

we expect req.url is actually url but in express.js middleware we must use req.originUrl

@dinwwwh dinwwwh changed the title feat(server, openapi)!: remove CompositeHandler and rewrite handler APIs feat(server, openapi)!: rewrite ORPCHandler, OpenAPIHandler Jan 6, 2025
@dinwwwh dinwwwh merged commit 911bdd9 into main Jan 6, 2025
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