-
Notifications
You must be signed in to change notification settings - Fork 15
feat(ensapi): add openapi #1338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Installs `hono-openapi` - Updates `validate.ts` to use `validator` from `hono-openapi` - Adds response zod schemas to ensnode-sdk - Adds `describeRoute` to resolution endpoints - Adds `GET /openapi.json` route
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
lightwalker-eth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevedylandev This looks like an exciting direction to me. Appreciate your advice on next steps 👍
The Hono OpenAPI implementation with Zod produces a JSON schema where `z.undefined()` is [unrepresentable](https://zod.dev/json-schema#unrepresentable). This commit refactors the `NameTokensRequest` type and by consequence update the zod schema to pass. In order for OpenAPI JSON schema to work we cannot have any instances of unrepresentable APIs, and this so far was the only case.
This PR starts implementation of
hono-openapito complete #1115. Work includes:hono-openapivalidate.tsto usevalidatorfromhono-openapidescribeRouteto resolution endpointsGET /openapi.jsonrouteThe result is an OpenAPI schema that can be fetched from
/openapi.jsonfrom the ENSApi:With the schema we can build new documentation that accepts OpenAPI for automatic API references. At least for the API we can write almost all of the documentation inside the routes themselves. Here is an example:
Note
I don't like escaping characters in the mark up so I will be looking into another way to do this
This results in a docs page like this:
Take a look at the current preview built in a separate repo: https://docs-sepia-eight.vercel.app/docs/getApiResolveRecords