filipeue-swagger-js-codegen

1.13.2 • Public • Published

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",
    ...
  },

Readme

Keywords

Package Sidebar

Install

npm i filipeue-swagger-js-codegen

Weekly Downloads

1

Version

1.13.2

License

Apache-2.0

Unpacked Size

141 kB

Total Files

29

Last publish

Collaborators

  • filipeue