https://github.com/differui/oas-typegen
Generate JSDoc/TS/DTS type definitions from OpenAPI document(V2).
https://github.com/differui/oas-typegen
cli jsdoc openapi typescript typescript-definitions
Last synced: 20 days ago
JSON representation
Generate JSDoc/TS/DTS type definitions from OpenAPI document(V2).
- Host: GitHub
- URL: https://github.com/differui/oas-typegen
- Owner: differui
- License: mit
- Created: 2018-11-28T08:51:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-25T09:17:32.000Z (over 7 years ago)
- Last Synced: 2025-07-12T14:46:09.868Z (9 months ago)
- Topics: cli, jsdoc, openapi, typescript, typescript-definitions
- Language: TypeScript
- Homepage:
- Size: 89.8 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
oas-typegen [](https://circleci.com/gh/differui/oas-typegen) [](https://www.npmjs.com/package/oas-typegen) [](https://opensource.org/licenses/MIT)
=====
> Generate JSDoc/TS/DTS type definitions from OpenAPI document(V2).
## Installation
```bash
npm install oas-typegen -g
```
## Usage
```bash
typegen -i http://petstore.swagger.io/v2/swagger.json
```
## Options
```
Generate TS/JS/DTS type definitions from OpenAPI document (V2).
Usage
$ typegen --input --output
Options:
--input, -i (required) Path to OpenAPI document in local file system or
url on lines.
--output, -o The output path and file for generated assets.
--dir, -d The output directory for generated assets. Use current dire-
tory by default.
--name, -n Specifies the name of your swagger document.
--config, -c Use this config file(if argument is used but value is unspe-
cified, defaults to typegen.json).
--format, -f Type of output assets (cjs, es).Use "es" by default.
--language, -l Choice one output language in js ts and dts
> js: (default) create a .js file and comment with JSDoc
> ts: create a .ts file and declare types as interfaces
> dts: create a .js file and declare types in a .d.ts
--plugin, -p Load the plugin from local node_modules.
--intro Content to insert at top of generated type file.
--outro Content to insert at bottom of generated type file.
--serial, -e Force build multi-documents one by one.
--silent, -s Prevent output from being displayed in stdout.
--version, -v Print current version number.
--help, -h Print this message.
Examples:
$ typegen --input ./swagger.json --output gateway.js --language js
$ typegen --input http://petstore.swagger.io/v2/swagger.json --output petsto-
re.js
```
## License
© [differui](mailto:differui@gmail.com)