Skip to content

feat: migrate resolution api to Zod OpenAPI#1662

Merged
notrab merged 11 commits intomainfrom
zod-openapi-resolution-routes
Feb 24, 2026
Merged

feat: migrate resolution api to Zod OpenAPI#1662
notrab merged 11 commits intomainfrom
zod-openapi-resolution-routes

Conversation

@notrab
Copy link
Copy Markdown
Member

@notrab notrab commented Feb 23, 2026

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • Converted the 3 resolution-api endpoints (/records/:name, /primary-name/:address/:chainId, /primary-names/:address) from hono-openapi (describeRoute + validate) to @hono/zod-openapi (createRoute + app.openapi).
  • Extracted route metadata into a new resolution-api.routes.ts file and registered it in openapi-routes.ts for env-free spec generation.

Why

Continues the incremental migration started in #1661 to enable OpenAPI spec generation at build time without starting the server or requiring env vars.


Testing

  • TypeScript type-check passes (tsc --noEmit)
  • Linter passes (biome check)
  • No behavioural changes to handler logic. Only the route registration mechanism changed!

Notes for Reviewer (Optional)

  • Handler logic, middleware setup (makeIsRealtimeMiddleware, canAccelerateMiddleware), and all Zod schemas are unchanged. This is a purely structural conversion.
  • The /records/{name} query schema preserves the existing .transform() that calls params.selection.parse() internally.
  • validate.ts and hono-openapi are intentionally left in place. Other unconverted routes still depend on them.

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

Copilot AI review requested due to automatic review settings February 23, 2026 07:12
@notrab notrab requested a review from a team as a code owner February 23, 2026 07:12
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
admin.ensnode.io Skipped Skipped Feb 24, 2026 9:54am
ensnode.io Skipped Skipped Feb 24, 2026 9:54am
ensrainbow.io Skipped Skipped Feb 24, 2026 9:54am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 23, 2026

Warning

Rate limit exceeded

@notrab has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 52 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ba81919 and 9539e8d.

📒 Files selected for processing (3)
  • apps/ensapi/src/handlers/resolution-api.routes.ts
  • apps/ensapi/src/handlers/resolution-api.ts
  • apps/ensapi/src/stub-routes.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch zod-openapi-resolution-routes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 23, 2026

⚠️ No Changeset found

Latest commit: 9539e8d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 23, 2026

Greptile Summary

This PR successfully migrates the resolution API's three endpoints from the legacy hono-openapi library to the modern @hono/zod-openapi library. The migration extracts route metadata into a dedicated resolution-api.routes.ts file and registers these routes in the OpenAPI spec generator, enabling build-time spec generation without runtime dependencies or environment variables.

Key changes:

  • Created resolution-api.routes.ts with createRoute definitions for /records/{name}, /primary-name/{address}/{chainId}, and /primary-names/{address}
  • Replaced app.get + describeRoute + validate with app.openapi in resolution-api.ts
  • Changed factory.createApp() to createApp() (both return OpenAPIHono instances with the same configuration)
  • Added resolution routes to openapi-routes.ts for spec generation

No behavioral changes - all handler logic, middleware, validation schemas, and the critical .transform() logic in the records query schema remain identical.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • This is a purely structural refactor with zero changes to handler logic, middleware, or validation schemas. The migration follows an established pattern (matching amirealtime-api.routes.ts), all necessary files are present, and the route definitions correctly preserve the existing .transform() behavior for the records query schema.
  • No files require special attention

Important Files Changed

Filename Overview
apps/ensapi/src/handlers/resolution-api.routes.ts New file defining route metadata for resolution API endpoints using @hono/zod-openapi createRoute - clean implementation following the established pattern
apps/ensapi/src/handlers/resolution-api.ts Migrated from hono-openapi to @hono/zod-openapi by replacing app.get + describeRoute + validate with app.openapi - handler logic unchanged
apps/ensapi/src/openapi-routes.ts Added resolutionRoutes to the spec generator - follows the same pattern as existing amIRealtimeRoutes

Last reviewed commit: 0d515e2

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – ensrainbow.io February 23, 2026 07:15 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io February 23, 2026 07:15 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io February 23, 2026 07:15 Inactive
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to migrate the resolution API's three endpoints (/records/:name, /primary-name/:address/:chainId, /primary-names/:address) from the legacy hono-openapi pattern to @hono/zod-openapi, following the pattern established in PR #1661. The migration extracts route metadata into a separate routes file to enable environment-free OpenAPI spec generation at build time.

Changes:

  • Converted handler registration from app.get + describeRoute + validate to app.openapi with route definitions
  • Replaced factory.createApp() with createApp() to use OpenAPIHono
  • Extracted route metadata to resolution-api.routes.ts (missing from PR)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
apps/ensapi/src/handlers/resolution-api.ts Migrated three endpoint handlers to use app.openapi() pattern and import route definitions from missing routes file
apps/ensapi/src/openapi-routes.ts Added import and registration for resolution routes module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@notrab
Copy link
Copy Markdown
Member Author

notrab commented Feb 23, 2026

@greptile-apps re-review

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@notrab Looks good

Base automatically changed from zod-openapi-amirealtime-routes to main February 24, 2026 09:51
Copilot AI review requested due to automatic review settings February 24, 2026 09:54
@vercel vercel bot temporarily deployed to Preview – ensnode.io February 24, 2026 09:54 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io February 24, 2026 09:54 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io February 24, 2026 09:54 Inactive
@notrab notrab merged commit 2e772ab into main Feb 24, 2026
17 checks passed
@notrab notrab deleted the zod-openapi-resolution-routes branch February 24, 2026 09:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


import { params } from "@/lib/handlers/params.schema";

export const basePath = "/resolve";
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

basePath is used by createStubRoutesForSpec() to prefix each route’s path for OpenAPI generation. Since the resolution handler is mounted under /api (see index.ts -> app.route("/api", ensNodeApi) and ensnode-api.ts -> app.route("/resolve", resolutionApi)), the externally reachable paths are /api/resolve/.... As written, the generated spec paths will be missing the /api prefix. Consider changing basePath to /api/resolve (or otherwise incorporating the parent mount path into spec generation).

Suggested change
export const basePath = "/resolve";
export const basePath = "/api/resolve";

Copilot uses AI. Check for mistakes.
Comment on lines 3 to 15
@@ -10,7 +11,7 @@ import * as amIRealtimeRoutes from "./handlers/amirealtime-api.routes";
export function createStubRoutesForSpec() {
const app = new OpenAPIHono();

const routeGroups = [amIRealtimeRoutes];
const routeGroups = [amIRealtimeRoutes, resolutionRoutes];

Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The PR description mentions registering the new route metadata in openapi-routes.ts, but this change registers resolution-api.routes in stub-routes.ts instead. To avoid confusion for reviewers/follow-ups, update the PR description (or ensure the intended spec registration file exists and is used).

Copilot uses AI. Check for mistakes.
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.

3 participants