npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@workos/oagen

v0.3.0

Published

Framework for building OpenAPI SDK emitters

Downloads

533

Readme

oagen

oagen is a framework for building custom SDK generators from OpenAPI 3.x specifications.

Its core job is narrow:

  • parse an OpenAPI spec into a typed intermediate representation (IR)
  • let language emitters turn that IR into files
  • regenerate the SDK when the spec changes

More advanced workflows, such as preserving the public API of an existing SDK during a migration to generation, is also supported.

Who This Is For

oagen is a fit if you:

  • need more control than off-the-shelf generators give you
  • want to build or maintain a custom emitter for one or more languages
  • care about generated output being idiomatic for a specific SDK style

oagen is probably not a fit if you:

  • just want a turnkey SDK generator with batteries included
  • do not want to maintain emitter code
  • do not need a reusable IR or generation framework

Core Concept

oagen has a small core:

  • Parser: OpenAPI 3.x -> ApiSpec IR
  • Emitter runtime: ApiSpec -> GeneratedFile[]
  • Diffing: compare spec versions and map changes to generated output

Advanced features such as API-surface extraction, compatibility overlays, smoke verification, and live-SDK integration are available, but they are optional. You can ignore them until you need them.

Quickstart

Install the package:

npm install @workos/oagen

Inspect a spec:

oagen parse --spec openapi.yml

Create an emitter project:

oagen init --lang ruby --project ./my-emitter
cd ./my-emitter

Generate files with your emitter:

npm run sdk:generate -- --spec ../openapi.yml --namespace MyService

For the shortest end-to-end setup, see Minimal Quickstart.

The Core API

The default @workos/oagen entrypoint is intentionally focused on the framework core:

import {
  diffSpecs,
  generate,
  generateFiles,
  getEmitter,
  parseSpec,
  planOperation,
  registerEmitter,
  toCamelCase,
  toPascalCase,
  toSnakeCase,
} from "@workos/oagen";
import type {
  ApiSpec,
  Emitter,
  EmitterContext,
  GeneratedFile,
  Model,
  Enum,
  Service,
  OperationPlan,
} from "@workos/oagen";

Advanced compat and verification APIs are available through explicit subpaths:

import {
  buildOverlayLookup,
  patchOverlay,
  registerExtractor,
} from "@workos/oagen/compat";
import { runCompatCheck, runOverlayRetryLoop } from "@workos/oagen/verify";

Building an Emitter

Emitters are pure functions over the IR. They receive typed IR nodes and return GeneratedFile[].

import type { Emitter } from "@workos/oagen";

const myEmitter: Emitter = {
  language: "go",
  generateModels: (models, ctx) => [
    /* ... */
  ],
  generateEnums: (enums, ctx) => [
    /* ... */
  ],
  generateResources: (services, ctx) => [
    /* ... */
  ],
  generateClient: (spec, ctx) => [
    /* ... */
  ],
  generateErrors: () => [],
  generateConfig: () => [],
  generateTests: () => [],
  fileHeader: () => "// Auto-generated by oagen. Do not edit.",
};

Start with:

Commands

| Command | Purpose | | ---------------- | --------------------------------------------------- | | oagen parse | Parse a spec and print IR JSON | | oagen init | Scaffold an emitter project | | oagen generate | Run a registered emitter | | oagen diff | Compare two specs and output a diff report | | oagen extract | Advanced: extract an SDK API surface for compat use | | oagen verify | Advanced: smoke-test output and run compat checks |

See CLI Reference.

Documentation

Advanced Workflows

oagen also includes tooling for a more opinionated migration workflow:

  • extract the public API of an existing SDK
  • generate a replacement while preserving names and exports
  • verify the generated SDK against smoke tests and compatibility checks
  • integrate generated files into a live SDK tree

Those workflows are documented separately because they are not required to use the core framework:

AI / Plugin Tooling

This repo ships with Claude Code plugin assets and skills for scaffold-and-verify workflows. The framework is usable without any agent tooling.

If you need them, start here:

Development

npm install
npm run build
npm test
npm run typecheck