feat(zod-openapi): add defineOpenAPIRoute and openapiRoutes for batch route registration#1752
Conversation
…inition and type safety
…inition and type safety
…agement and type safety
🦋 Changeset detectedLatest commit: ae04edc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This pull request is the implementation for the proposed feature 1751. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1752 +/- ##
==========================================
+ Coverage 92.68% 92.73% +0.04%
==========================================
Files 112 112
Lines 3733 3744 +11
Branches 946 946
==========================================
+ Hits 3460 3472 +12
+ Misses 245 244 -1
Partials 28 28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…th addRoute set to false
|
I pushed fixes for the previous CI errors. Could a maintainer please rerun the failing workflow checks (or “Re-run all jobs”) when you have a moment? Thanks! |
Description
This PR adds two new utilities to improve route definition and registration in
@hono/zod-openapi:defineOpenAPIRoute: Provides explicit type safety for route definitionsopenapiRoutes: Enables batch registration of multiple routes with full type safetyProblem
Solution
defineOpenAPIRoute: Wraps route definitions with explicit types for better IDE support and type checkingopenapiRoutes: Accepts an array of route definitions and registers them all at onceaddRouteflag for conditional registrationBenefits
Examples
See the updated README for usage examples.
Testing
Documentation