Generate TypeScript typings based on an OpenAPI schema object.

Usage no npm install needed!

<script type="module">
  import seinopsysForksOpenapiToTypescript from 'https://cdn.skypack.dev/@seinopsys-forks/openapi-to-typescript';



NPM version Build Status

Generate TypeScript typings based on an OpenAPI 3 schema definition.


Run npm install @seinopsys-forks/openapi-to-typescript or yarn add @seinopsys-forks/openapi-to-typescript

Usage in JavaScript

const { GenerateTypings } = require('@seinopsys-forks/openapi-to-typescript')

const generatedTypescriptCode = await GenerateTypings(openapiSchema)
fs.writeFileSync('out.ts', generatedTypescriptCode)

CLI Usage

yarn cli --help

For development

const { GenerateTypings } = require('./dist/index')

GenerateTypings(require('./fixtures/petstore.json')).then((generatedTypescriptCode: string) => {
  fs.writeFileSync('out.ts', generatedTypescriptCode)

Releasing new versions

Run npm run release, it will lint and build the project before running np to actually publish the new version. Follow the prompts to create the release.