Enforce OpenAPI types
Hey there,
I'm currently working on a
openapi-router
package, which aims to enforce types (generated from an OpenAPI document using openapi-typescript
) in the routers of web frameworks like Hono or ExpressJs.
I've successfully added support for ExpressJs, as its typings are relatively straightforward. However, I'm finding the Hono types more complex, and I could use some assistance in creating the appropriate Hono types for the openapi-router
package.
Is it even feasible to integrate Hono's advanced typing system with openapi-router
? Any guidance or tips would be appreciated.
Thanks 🙂
Context:
- Hono Types: https://github.com/honojs/hono/blob/main/src/types.ts
- Express types for openapi-router
: https://github.com/inbeta-group/monorepo/blob/develop/packages/openapi-router/src/types/features/express.ts
- Express example for openapi-router
: https://github.com/inbeta-group/monorepo/tree/develop/examples/openapi-router/express/petstoreGitHub
hono/src/types.ts at main · honojs/hono
Web framework built on Web Standards. Contribute to honojs/hono development by creating an account on GitHub.
GitHub
monorepo/packages/openapi-router/src/types/features/express.ts at d...
Contribute to inbeta-group/monorepo development by creating an account on GitHub.
GitHub
monorepo/examples/openapi-router/express/petstore at develop · inbe...
Contribute to inbeta-group/monorepo development by creating an account on GitHub.
3 Replies
Ok doesn't seem to be possible (yet).
https://github.com/honojs/hono/pull/1634
GitHub
feat(req): support generics for query/queries/header by yusukebe · ...
May resolve #1632
Author should do the followings, if applicable
Add tests
Run tests
yarn denoify to generate files for Deno
ok seems to be possible via the validator interface
wip: https://github.com/inbeta-group/monorepo/pull/49
Managed to make it somewhat work. Will improve it over time. I'm quite new to Hono but like it so far.
https://discord.com/channels/1011308539819597844/1012485565087748156/1260595634583638076