Skip to content

Repository files navigation

ResponsibleAPI

TypeScript tooling for defining OpenAPI 3.1 contracts and validating Hono handlers against them.

Blog post: How to OpenAPI

Packages

Define An API

bun add @responsibleapi/ts
import{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(),}),}),},}),},})

Use With Hono

bun add @responsibleapi/hono
import{openApiRouter}from"@responsibleapi/hono"import{Hono}from"hono"importtype{oas31}from"openapi3-ts"newHono().route("",openApiRouter({
handlers,
securityHandlers,doc: apiasoas31.OpenAPIObject,}),)

Development

task check

About

A small language that compiles to OpenAPI

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages