Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR introduces OpenAPI generation capabilities for ENSApi by adding a new npm script, creating a TypeScript-based OpenAPI document generator, and updating documentation configuration and guides to reference the generated OpenAPI specification file. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
apps/ensapi/package.json
Outdated
| "lint:ci": "biome ci", | ||
| "typecheck": "tsgo --noEmit" | ||
| "typecheck": "tsgo --noEmit", | ||
| "generate:openapi": "tsx scripts/generate-openapi.ts" |
There was a problem hiding this comment.
This is auto-discovered, so any other packages can add a script for controlling their OpenAPI spece generation (so that logic stays relative to the folder), but the root script discovers this and outputs the files to the root openapi folder.
package.json
Outdated
| "docker:build:ensadmin": "docker build -f apps/ensadmin/Dockerfile -t ghcr.io/namehash/ensnode/ensadmin:latest .", | ||
| "docker:build:ensrainbow": "docker build -f apps/ensrainbow/Dockerfile -t ghcr.io/namehash/ensnode/ensrainbow:latest .", | ||
| "docker:build:ensapi": "docker build -f apps/ensapi/Dockerfile -t ghcr.io/namehash/ensnode/ensapi:latest .", | ||
| "generate:openapi": "pnpm -r generate:openapi", |
There was a problem hiding this comment.
Commented above why this is important for enabling multiple OpenAPI spec files/generation across projects to be autodiscovered.
There was a problem hiding this comment.
Mintlify has no scope to go to the monorepo directory, so we need to symlink tpo it.
There was a problem hiding this comment.
Looks like Mintlify still can't follow the symlink. Will try another method.
There was a problem hiding this comment.
Pull request overview
Adds a generated-from-source, committed OpenAPI 3.1 spec for ENSApi and wires it into docs + scripts to support preview builds and future multi-spec expansion across the monorepo.
Changes:
- Add an ENSApi script to generate a static OpenAPI 3.1 document and commit the generated spec at
openapi/ensapi-openapi.json. - Add
generate:openapiscripts at the app and monorepo root for easy regeneration. - Update Mintlify docs config to point the live API reference at the production OpenAPI endpoint and add a hidden preview group that references the committed spec file.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Bumps pinned pnpm version and adds a root generate:openapi script. |
| apps/ensapi/package.json | Adds generate:openapi script for ENSApi. |
| apps/ensapi/scripts/generate-openapi.ts | New generator script that writes the spec and formats it. |
| openapi/ensapi-openapi.json | Newly committed generated OpenAPI 3.1 spec. |
| docs/docs.ensnode.io/docs.json | Points API Reference to live OpenAPI endpoint and adds hidden preview spec reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
openapi/ensapi-openapi.json
Outdated
| "schema": { | ||
| "type": "string", | ||
| "default": false | ||
| }, | ||
| "required": false, | ||
| "name": "trace", | ||
| "in": "query" | ||
| }, | ||
| { | ||
| "schema": { | ||
| "type": "string", | ||
| "default": false | ||
| }, | ||
| "required": false, |
There was a problem hiding this comment.
This parameter schema declares type: "string" but sets default: false (a boolean). That makes the generated OpenAPI document inconsistent/invalid for schema-aware tooling and client generation. Either emit a string default (e.g. "false"), omit the default, or model the parameter as a boolean in the OpenAPI output.
openapi/ensapi-openapi.json
Outdated
| "schema": { | ||
| "type": "string", | ||
| "default": false, | ||
| "description": "Filter to only include actions with referrals" | ||
| }, | ||
| "required": false, |
There was a problem hiding this comment.
This query parameter schema has type: "string" but default: false (boolean). This type/default mismatch can break OpenAPI validators and generated clients. Consider emitting a string default ("false"), removing the default, or changing the schema to boolean in the generated spec.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/ensapi/scripts/generate-openapi.ts`:
- Around line 19-20: The path for outputPath is brittle because it uses
hardcoded "../../.." traversal from __dirname; replace that with a robust root
discovery (e.g., implement a findMonorepoRoot function that walks parent
directories from dirname(fileURLToPath(import.meta.url)) or uses an env var like
MONOREPO_ROOT) and then build outputPath by resolve(monorepoRoot, "openapi",
"ensapi-openapi.json"); update references to __dirname/outputPath to use
fileURLToPath, dirname, and the new findMonorepoRoot (or env fallback) so the
script no longer depends on the file's exact relative depth.
In `@docs/docs.ensnode.io/docs.json`:
- Around line 30-31: The "Preview" group in docs.json references a non-existent
page "ensapi/preview" in its "pages" array; either remove "ensapi/preview" from
the "pages" array in the Preview group configuration or create a matching docs
file (e.g., add ensapi/preview.mdx) with the expected frontmatter and content so
the reference resolves; locate the "group": "Preview" entry and update its
"pages" array or add the new "ensapi/preview.mdx" file accordingly.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
apps/ensapi/package.jsonapps/ensapi/scripts/generate-openapi.tsdocs/docs.ensnode.io/docs.jsonopenapi/ensapi-openapi.jsonpackage.json
Greptile SummaryAdds a script to generate OpenAPI spec from source, replacing the manual Gist workflow. The script implementation is solid with proper error handling and formatting.
Confidence Score: 0/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[pnpm generate:openapi] -->|executes| B[scripts/generate-ensapi-openapi.ts]
B -->|imports| C[generateOpenApi31Document from @/openapi-document]
C -->|generates| D[OpenAPI 3.1 JSON document]
D -->|writes to| E[docs/docs.ensnode.io/ensapi-openapi.json]
E -->|formats with| F[Biome formatter]
F -->|committed file| G[Git repository]
G -->|referenced by| H[docs.json Preview section]
H -->|renders in| I[Mintlify docs site]
J[docs.json API Reference] -->|points to| K[https://api.alpha.ensnode.io/openapi.json]
style E fill:#ff6b6b
style G fill:#ff6b6b
style H fill:#ffe66d
Last reviewed commit: 538b97c |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| { | ||
| "group": "Preview", | ||
| "pages": ["ensapi/preview"], |
There was a problem hiding this comment.
docs.json adds a Preview group that references "pages": ["ensapi/preview"], but there is no corresponding docs/docs.ensnode.io/ensapi/preview.mdx in the repo. Mintlify builds typically fail or show a 404 when navigation references a non-existent page. Either add the missing page file or remove the pages entry if the OpenAPI group is intended to stand alone.
| "pages": ["ensapi/preview"], |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.error("Error: Failed to format with Biome."); | ||
| if (error instanceof Error) { | ||
| const err = error as NodeJS.ErrnoException & { status?: number }; | ||
| if (err.code === "ENOENT") { | ||
| console.error("'pnpm' or 'biome' is not available on your PATH."); | ||
| } else if (err.status !== undefined) { | ||
| console.error(`Biome exited with code ${err.status}.`); | ||
| console.error("Try running 'pnpm biome format --write' manually to debug."); | ||
| } else if (err.message) { |
There was a problem hiding this comment.
The Biome failure guidance is slightly misleading: the script runs pnpm exec biome format --write ..., but the error message suggests running pnpm biome format --write manually. Updating the message to match the actual command (and/or printing the exact command that failed) will make this easier to debug.
| "group": "API Reference", | ||
| "openapi": "https://gist.githubusercontent.com/notrab/94b637e77468cbddd895d7933ce88f64/raw/12cb5ed183558a9bdda5d1c7004db6c794dbd13e/green-ensnode-openapi.json" | ||
| "openapi": "https://api.alpha.ensnode.io/openapi.json" | ||
| }, | ||
| { | ||
| "group": "Preview", | ||
| "pages": ["ensapi/preview"], | ||
| "openapi": "ensapi-openapi.json", | ||
| "hidden": true |
There was a problem hiding this comment.
The docs now point the public “API Reference” OpenAPI source at the live https://api.alpha.ensnode.io/openapi.json. That endpoint currently includes a Local Development server entry (http://localhost:<port>) in the served spec, which will show up in the published docs and can confuse users. Consider either (a) pointing this group at the committed static spec (which omits localhost) or (b) changing the API’s /openapi.json generation to only add the localhost server in local/dev environments.
There was a problem hiding this comment.
We can't add localhost to the spec file unless we hard code the port since we don't have access (by design) to the config.port. We'll need to resolve this (by removing the local development server completely to always create a spec that can be correctly validated/diffed).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "group": "API Reference", | ||
| "openapi": "https://gist.githubusercontent.com/notrab/94b637e77468cbddd895d7933ce88f64/raw/12cb5ed183558a9bdda5d1c7004db6c794dbd13e/green-ensnode-openapi.json" | ||
| "openapi": "https://api.alpha.ensnode.io/openapi.json" | ||
| }, |
There was a problem hiding this comment.
docs.json now points the API reference OpenAPI spec to the live alpha endpoint (https://api.alpha.ensnode.io/openapi.json), but this PR also introduces a generator that writes a committed static spec at docs/docs.ensnode.io/ensapi-openapi.json. As-is, the generated/committed spec is not referenced anywhere, and the docs site will still depend on a running server (and will include the localhost server entry). Consider changing this openapi value to the committed file path (or, if the intent is to use the live endpoint, remove/relocate the generator and update the PR description accordingly).
There was a problem hiding this comment.
My proposal is we remove the local development server object.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@greptile-apps re-review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| "group": "Preview", | ||
| "pages": ["ensapi/preview"], | ||
| "openapi": "ensapi-openapi.json", |
There was a problem hiding this comment.
docs.json references a local OpenAPI file (ensapi-openapi.json) for the Preview group, but that file does not exist in the repo (under docs/docs.ensnode.io/). Either commit the generated spec at that path or adjust the build process/docs.json so the file is generated/copied before Mintlify loads it; otherwise the Preview OpenAPI reference will be broken.
| "openapi": "ensapi-openapi.json", |
| "docker:build:ensapi": "docker build -f apps/ensapi/Dockerfile -t ghcr.io/namehash/ensnode/ensapi:latest .", | ||
| "otel-desktop-viewer": "docker run -p 8000:8000 -p 4317:4317 -p 4318:4318 davetron5000/otel-desktop-viewer:alpine-3" | ||
| "otel-desktop-viewer": "docker run -p 8000:8000 -p 4317:4317 -p 4318:4318 davetron5000/otel-desktop-viewer:alpine-3", | ||
| "generate:openapi": "tsx --tsconfig apps/ensapi/tsconfig.json scripts/generate-ensapi-openapi.ts" |
There was a problem hiding this comment.
The root-level generate:openapi script invokes tsx, but tsx is not listed in the root devDependencies. With pnpm workspaces, running this script from the repo root likely won’t have the tsx binary on PATH, so pnpm generate:openapi will fail. Consider either adding tsx to the root devDependencies or running it via the ensapi workspace (e.g. pnpm --filter ensapi exec tsx ...).
| console.error("'pnpm' or 'biome' is not available on your PATH."); | ||
| } else if (err.status !== undefined) { | ||
| console.error(`Biome exited with code ${err.status}.`); | ||
| console.error("Try running 'pnpm biome format --write' manually to debug."); |
There was a problem hiding this comment.
The debug hint prints Try running 'pnpm biome format --write' ..., but there is no biome script in the root package.json, so that command will likely fail. Suggest updating the message to match the actual invocation (pnpm exec biome format --write ...) so users can reliably follow it.
| console.error("Try running 'pnpm biome format --write' manually to debug."); | |
| console.error("Try running 'pnpm exec biome format --write' manually to debug."); |
Lite PR
Tip: Review docs on the ENSNode PR process
Summary
scripts/generate-ensapi-openapi.tsscript that generates a static OpenAPI 3.1 JSON spec from the existinggenerateOpenApi31Document()functiongenerate:openapiscript to rootpackage.jsonfor running the generatordocs/docs.ensnode.io/ensapi-openapi.jsonand formatted with Biome{appname}-openapi.jsonnaming convention per Set foundation for multiple OpenAPI.json files #1600, ready for future specsWhy
{appname}-openapi.jsonnaming sets foundation for multiple specs per Set foundation for multiple OpenAPI.json files #1600Testing
pnpm generate:openapi— producesdocs/docs.ensnode.io/ensapi-openapi.jsonwith Biome formattingNotes for Reviewer (Optional)
generateOpenApi31Document()which has zero runtime deps (stub handlers, no config/env)/openapi.jsonminus the localhost server entry (posted in Slack about this)openapi/directory documentationPre-Review Checklist (Blocking)