tool for generating typescript types for a swagger client
Last updated 3 years ago by duecourse .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install swagger-client-typegen 
SYNC missed versions from official npm registry.


A tool for generating typescript type definitions for swagger clients given a swagger spec.

The types generated by this tool describe the 'Tags Interface' of a swagger-client client. See https://www.npmjs.com/package/swagger-client#tags-interface



The tool is invoked from the command line. It Reads a spec from stdin and emits typescript code on stdout.


cat ./swagger-spec.json | node index.js MyClient > myClient.d.ts

We can just as easily use a swagger spec hosted on a running service (for example as served by hapi-swagger) by using curl to retrieve the spec

curl https://service.example.com/swagger.json | node index.js MyClient > myClient.d.ts


One way of using the tool would be for a service to have an npm script/make task to generate types for itself as part of its build, test, or pre-commit stage and then publish these, to a dedicated npm package, or perhaps to s3.

Consumers could then install the client package, or download the code from s3 upon build and compilie against the type definitions.

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago
Maintainers (1)
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (9)
Dev Dependencies (8)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |