feat: auto-generate supported routes docs page (#949)#979
feat: auto-generate supported routes docs page (#949)#979
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces an automated way to generate and maintain a documentation page detailing the supported routes and assets within the BOB Gateway. By fetching live data from the API and tokenlist, the generated MDX page provides an up-to-date reference for developers and users. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces an automated process to generate documentation for supported routes from the gateway API, enriching it with token symbols from the tokenlist. The changes include adding a new routes-docs target to the Makefile, integrating it into the openapi target, updating the docs.json navigation, and adding the TypeScript script responsible for generating the MDX documentation page. This is a valuable addition for keeping the documentation up-to-date with the live API.
| // Load tokenlist | ||
| const tokenlistPath = resolve( | ||
| dirname(new URL(import.meta.url).pathname), | ||
| "../../../tokenlist/tokenlist.json" | ||
| ); |
There was a problem hiding this comment.
The tokenlistPath is resolved using a fragile relative path (../../../tokenlist/tokenlist.json). This path is sensitive to changes in the script's location or the tokenlist's location. Using an environment variable, a configuration file, or a more robust path resolution utility would improve the script's maintainability and resilience to file system structure changes.
There was a problem hiding this comment.
The path is resolved relative to the script's own location using import.meta.url, which is the standard ESM approach. It doesn't break if the CWD changes — only if the script or tokenlist move relative to each other. Given both live in the same repo, this is stable.
|
Closes #949 |
gregdhill
left a comment
There was a problem hiding this comment.
Can we have the token addresses in the table? Also is there a way to fetch this dynamically rather than PR based? The routes may often change without us directly updating the spec
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nd fallback lookup Add swell (1923) and telos (40) to chain ID mapping, handle aptos as non-EVM chain, and add address-based fallback for cross-chain tokens like WBTCOFT that share the same address across chains. Reduces "Unknown" token entries from 28 to 0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge token addresses from @eth-optimism/tokenlist for gateway-supported chains. Adds 16 new entries: WETH, wstETH, rETH, sfrxETH, UNI, FRAX, FXS, USDT, T, TRB on Optimism, and WETH, wstETH, rETH, tBTC, UNI, TRB on Base. Total tokens: 151 -> 167. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the hardcoded CHAIN_NAME_TO_ID mapping entirely. Since each token has a unique contract address in the tokenlist, we can resolve symbols by address alone without needing chain IDs. This means new chains added to the gateway API are automatically supported as long as the token addresses exist in the tokenlist. Also logs warnings for unresolved tokens to surface gaps. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove interfaces, intermediate data structures, and redundant passes. 211 -> 87 lines. Same output, zero dependencies, auto-handles new chains. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove truncated address columns from tables (users can check tokenlist for addresses), use Map.groupBy, trim MDX boilerplate. 87 -> 58 lines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace static generated MDX with an inline React component that fetches routes from the Gateway API and token symbols from the GitHub-hosted tokenlist at page load. Adds source/destination address columns. Removes the generate-routes.ts script and routes-docs Makefile target. Addresses review feedback: routes stay current without PRs, and token addresses are now visible in the table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3a9e2e3 to
f4ab63c
Compare
|
Updated to fetch it automatically at runtime: https://distributedcrafts-feat-949-auto-generate-routes-docs.mintlify.app/gateway/supported-routes |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
docs/gateway/scripts/generate-routes.ts) that fetches supported routes from the gateway API, resolves token symbols from the tokenlist, and generates a Mintlify docs pagedocs/gateway/gateway/supported-routes.mdx) shows all supported routes grouped by source chaindocusaurus-theme-openapi-docsand related deps that caused Vercel build failuresHow it works
make openapior standalone viamake routes-docshttps://gateway-api-mainnet.gobob.xyz/v1/get-routestokenlist/tokenlist.json— no chain ID mapping neededChanges since initial PR
docusaurus-theme-openapi-docs,docusaurus-plugin-openapi-docs,react-redux,@reduxjs/toolkit, and the Redux provider inRoot.js— API docs are served by Mintlify, and the transitivepostman-code-generatorsdep was causing webpackpathpolyfill errors on VercelTest plan
npx tsx docs/gateway/scripts/generate-routes.tsand verify the generated MDX filepnpm docusaurus buildindocs/)