Skip to content

feat: generate OpenAPI spec API#139

Open
o-az wants to merge 3 commits intomainfrom
o-az/openapi=schema
Open

feat: generate OpenAPI spec API#139
o-az wants to merge 3 commits intomainfrom
o-az/openapi=schema

Conversation

@o-az
Copy link
Copy Markdown
Collaborator

@o-az o-az commented Apr 28, 2026

ability to generate OpenAPI v3.2.0 automatically

import { Cli, Openapi, z } from 'incur'

const cli = Cli.create('my-cli', { description: 'My CLI' }).command('users list', {
  options: z.object({ limit: z.coerce.number().optional() }),
  run() {
    return { users: [] }
  },
})

const spec = Openapi.fromCli(cli)

validate: in exmaples/npm:

bun cli.ts

curl http://localhost:3000/openapi.json

note: other 'unrelated' changes are from pnpm check

playground https://stackblitz.com/edit/unjs-h3-sgf15m6f?file=server.mjs (visit /openapi.json in preview)

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

npm i https://pkg.pr.new/incur@139

commit: 91c79ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants