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

@kattebak/openapi-generator-ts

v1.0.0

Published

OpenAPI Generator - Generate code from OpenAPI specifications

Readme

@kattebak/openapi-generator-ts

A TypeScript port of the excellent OpenAPI Generator project.

Acknowledgments

This project stands on the shoulders of giants. The original OpenAPI Generator is a remarkable open-source project that has generated API clients, server stubs, and documentation for countless developers worldwide. We are deeply grateful to the OpenAPI Generator community for their years of work building and maintaining such a comprehensive and well-designed tool.

Motivation

While the original OpenAPI Generator is feature-complete and battle-tested, it requires a Java Virtual Machine (JVM) to run. This can be inconvenient in certain scenarios:

  • CI/CD pipelines where adding a JVM dependency increases container image sizes and build times
  • Node.js-only environments where maintaining a Java installation adds operational complexity
  • Quick local generation where startup time matters

This TypeScript port provides a native Node.js alternative that:

  • Eliminates the JVM dependency entirely
  • Offers faster startup times for small to medium specs
  • Integrates seamlessly into JavaScript/TypeScript toolchains
  • Uses the same Mustache-compatible templates as the original

Note: This is not a replacement for the original. If you need the full feature set, extensive generator library, or battle-tested stability, use the original OpenAPI Generator. This port focuses on common use cases with a subset of generators.

Installation

npm install @kattebak/openapi-generator-ts

Or run directly with npx:

npx @kattebak/openapi-generator-ts generate -i api.yaml -g typescript-fetch -o ./generated

Usage

CLI

# List available generators
openapi-generator list

# Validate an OpenAPI specification
openapi-generator validate -i openapi.yaml

# Generate client code
openapi-generator generate -i openapi.yaml -g typescript-fetch -o ./output

# Generate with additional properties
openapi-generator generate -i openapi.yaml -g python -o ./output \
  --additional-properties packageName=my_api,packageVersion=1.0.0

Programmatic API

import { generate, parseSpec } from '@kattebak/openapi-generator-ts';

// Parse and validate a spec
const { document } = await parseSpec('./openapi.yaml');

// Generate code
await generate({
  inputSpec: './openapi.yaml',
  generatorName: 'typescript-fetch',
  outputDir: './generated',
  additionalProperties: {
    npmName: '@myorg/api-client',
    npmVersion: '1.0.0',
  },
});

Available Generators

| Generator | Language | Description | |-----------|----------|-------------| | typescript-fetch | TypeScript | Client using the Fetch API | | python | Python | Python client with urllib3 | | go | Go | Go client with net/http | | php | PHP | PHP client (guzzle or psr-18) |

Configuration

Generator Options

Each generator supports additional properties that can be passed via --additional-properties or the programmatic API:

typescript-fetch:

  • npmName - NPM package name
  • npmVersion - NPM package version
  • supportsES6 - Generate ES6 code (default: true)

python:

  • packageName - Python package name
  • packageVersion - Package version
  • packageUrl - Package URL for setup.py

go:

  • packageName - Go package name
  • packageVersion - Package version
  • isGoSubmodule - Generate as Go submodule

php:

  • packageName - Composer package name
  • invokerPackage - Root namespace
  • composerVendorName - Composer vendor name

Templates

This generator uses Handlebars templates that are largely compatible with the original Mustache templates. Custom templates can be provided via the --template-dir option.

Syncing Templates from Original

Templates are synced from the original OpenAPI Generator repository. The sync script does a shallow clone and automatically converts Mustache syntax to Handlebars-compatible format:

# Sync templates for all generators
npm run sync-templates

# Sync specific generators only
./scripts/sync-templates.sh -g typescript-fetch,python

# Clean existing templates and re-sync
npm run sync-templates:clean

# Preview what would be synced (dry run)
./scripts/sync-templates.sh --dry-run

The sync script handles:

  • Shallow cloning of the original repository (cached in .template-cache/)
  • Removing Mustache delimiter changes ({{=<% %>=}})
  • Converting lambda syntax ({{#lambda.func}} to {{#func}})

Comparing Output to Original

To verify this port generates compatible output, you can compare against the original Java OpenAPI Generator:

# Generate with original (using Docker, no Java needed)
docker run --rm -v $(pwd):/local openapitools/openapi-generator-cli generate \
  -i /local/samples/petstore.yaml \
  -g typescript-fetch \
  -o /local/tmp/original-output

# Generate with this port
cd samples && make typescript-fetch

# Compare
diff -r tmp/original-output samples/build/typescript-fetch

For detailed comparison methodology and debugging tips, see AGENTS.md.

Requirements

  • Node.js >= 22.0.0

Development

# Install dependencies
npm install

# Sync templates from original OpenAPI Generator
npm run sync-templates

# Build
npm run build

# Run tests
npm test

# Type check
npm run typecheck

License

Apache-2.0 - Same as the original OpenAPI Generator.

See Also