openapi-to-typescript
v4.0.0
Published
Generate TypeScript typings based on an OpenAPI schema object.
Downloads
177
Readme
openapi-to-typescript
Generate TypeScript typings based on az OpenAPI3 schema definition.
Install
Run npm install openapi-to-typescript
or yarn add openapi-to-typescript
Usage in javascript
const { GenerateTypings } = require('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)
})