TypeScript d.ts file generator from JSON Schema file or Swagger spec file.
npm install -g dtsgenerator
$ dtsgen --help
Usage: dtsgen [options] <file ... | file patterns using node-glob>
Options:
-V, --version output the version number
--url <url> input json schema from the url.
--stdin read stdin with other files or urls.
-o, --out <file> output d.ts filename.
-p, --prefix <type prefix> set the prefix of interface name. default is nothing.
-H, --header <type header string> set the string of type header.
-t, --target [version] set target TypeScript version. select from `v2` or `v1`. default is `v2`.
-h, --help output usage information
Examples:
$ dtsgen --help
$ dtsgen --out types.d.ts schema/**/*.schema.json
$ cat schema1.json | dtsgen --target v1
$ dtsgen -o swaggerSchema.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v2.0/schema.json
$ dtsgen -o petstore.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/petstore.yaml
Output debug message by debug library.
$ DEBUG=dtsgen dtsgen schema/news.json
- The home of JSON Schema
- JSON Schema wiki for discussions on the next version of the draft
- Swagger Specification
v0.9.7 (2017-12-12)
- Support the integer enum type by #263. Thank you @heapx :*+1:
v0.9.6 (2017-09-28)
- Bug fix about unresoled $refs by #253. Thank you @skuligowski 👍
v0.9.5 (2017-07-24)
- Bug fix about tuple type support by #244. Thank you @laurelnaiad 👍
v0.9.4 (2017-07-22)
- Support tuple type of #239, #241. Thank you @laurelnaiad 👍
v0.9.2 (2017-06-19)
- Fix the bug about
allOf
property of #226. Thank you @dawidgarus @philliphoff 👍
v0.9.1 (2017-01-27)
- Improve message in error log. Thank you @gasi 👍
v0.9.0 (2016-12-15)
- Add yaml format support! Thank you @jdthorpe 👍
v0.8.2 (2016-11-7)
- Remove gulp scripts
v0.8.1 (2016-10-24)
v0.8.0 (2016-10-16)
- Add to support null type for TypeScript 2.0
- Add some input parameters
v0.7.2 (2016-9-19)
- Update dependencies library
v0.7.1 (2016-7-5)
- Fix crash bug #67
v0.7.0 (2016-7-3)
- Update with some braking change
v0.6.1 (2016-4-28)
- Minor update from v0.6.0
v0.6.0 (2016-4-14)
- First stable version of
dtsgenerator
dtsgenerator
is licensed under the MIT license.
Copyright © 2016, Hiroki Horiuchi