TypeScript tooling for defining OpenAPI 3.1 contracts and validating Hono handlers against them.
@responsibleapi/tsis the TypeScript DSL and compiler for OpenAPI 3.1 documents.@responsibleapi/honovalidates Hono requests and responses against OpenAPI documents.
bun add @responsibleapi/tsimport{GET,object,responsibleAPI,resp,string}from"@responsibleapi/ts"exportconstapi=responsibleAPI({partialDoc: {openapi: "3.1.0",info: {title: "Example API",version: "1.0.0",},},routes: {"/hello": GET({res: {200: resp({description: "OK",body: object({message: string(),}),}),},}),},})bun add @responsibleapi/honoimport{openApiRouter}from"@responsibleapi/hono"import{Hono}from"hono"importtype{oas31}from"openapi3-ts"newHono().route("",openApiRouter({
handlers,
securityHandlers,doc: apiasoas31.OpenAPIObject,}),)task check