Skip to content

A Swagger Codegen for typescript, nodejs & angularjs

License

Notifications You must be signed in to change notification settings

Filipeue/swagger-js-codegen

 
 

Repository files navigation

Swagger to JS & Typescript Codegen

This package generates a typescript or javascript class from a swagger specification url. The code is generated using mustache templates and beautified by prettier.

Installation

npm install https://github.com/bart-sk/swagger-js-codegen

or

yarn add https://github.com/bart-sk/swagger-js-codegen

Example

CLI

npx swagger2js generate {swaggerUrl} --type javascript > api.js

SwaggerUrl should be absolute url. Resulting class can be retrieved on stdout.

-t, --type
Either "javascript" or "typescript" (default: typescript)

--tags
Filter tags in swagger spec

-c --class
Class name (default: Api)

In package.json

  "scripts": {
    ...
    "generate-api": "npx swagger2js generate {swaggerUrl} > api.ts",
    ...
  },

About

A Swagger Codegen for typescript, nodejs & angularjs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 51.4%
  • HTML 48.6%