Generate TypeScript typings based on az OpenAPI3 schema definition.
Run npm install openapi-to-typescript
or yarn add openapi-to-typescript
const { GenerateTypings } = require('openapi-to-typescript')
const generatedTypescriptCode = await GenerateTypings(openapiSchema)
fs.writeFileSync('out.ts', generatedTypescriptCode)
yarn cli --help
const { GenerateTypings } = require('./dist/index')
GenerateTypings(require('./fixtures/petstore.json')).then((generatedTypescriptCode: string) => {
fs.writeFileSync('out.ts', generatedTypescriptCode)
})