New advertisers: 50% off your first month with code FIRSTMONTHSee slots
softaworks avatar

Openapi To Typescript

Converts OpenAPI 3.0 specs into TypeScript interfaces, request/response types, and type guards for validation.

skills.sh installs
4K
GitHub stars
2.7K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers the full workflow: validate the spec, extract schemas and endpoints, generate types, and write the output file
  • Maps primitives, formats, objects, arrays, enums, oneOf unions, and allOf intersections to TypeScript constructs
  • Enforces OpenAPI 3.0.x only, reports missing $ref targets, and stops on invalid specs
  • Designed for teams generating typed API clients and runtime guards from an existing specification

Install

$ npx -y skills add softaworks/agent-toolkit --skill openapi-to-typescript -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

OpenAPI to TypeScript

Converts OpenAPI 3.0 specifications to TypeScript interfaces and type guards.

Input: OpenAPI file (JSON or YAML) Output: TypeScript file with interfaces and type guards

When to Use

  • "generate types from openapi"
  • "convert openapi to typescript"
  • "create API interfaces"
  • "generate types from spec"

Workflow

  1. Request the OpenAPI file path (if not provided)
  2. Read and validate the file (must be OpenAPI 3.0.x)
  3. Extract schemas from components/schemas
  4. Extract endpoints from paths (request/response types)
  5. Generate TypeScript (interfaces + type guards)
  6. Ask where to save (default: types/api.ts in current directory)
  7. Write the file

OpenAPI Validation

Check before processing:

- Field "openapi" must exist and start with "3.0"
- Field "paths" must exist
- Field "components.schemas" must exist (if there are types)

If invalid, report the error and stop.

Type Mapping

Primitives

OpenAPITypeScript
stringstring
numbernumber
integernumber
booleanboolean
nullnull

Details

Repository
github.com/softaworks/agent-toolkit
Categories
Backend & APIs, Technical Documentation, Frontend & UI Code

More from softaworks/agent-toolkit

All 40

Similar to Openapi To Typescript

More Backend & APIs