@musement/types-generator
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

Types Generator

Types generator is a Typescript project that allows to generate types for Typescript or Flow starting from a Swagger/OpenAPI document.

Getting Started

Install Types generator using npm:

npm install --save-dev @musement/types-generator

Or yarn:

yarn add --dev @musement/types-generator

Add the following section to your package.json:

{
  "scripts": {
    "generate-types": "generate-types"
  }
}

Finally, run yarn generate-types or npm run generate-types

Running from command line

You can run type generator directly from the CLI if it's globally available in your PATH.

npm install -g @musement/types-generator

Or yarn:

yarn global add @musement/types-generator

Here's how to run types generator:

generate-types -s https://swagger -t Flow

Type generator CLI options

"--destination", "-d": local path where the generated file should be placed,
"--source", "-s": url to the swagger or path to the file,
"--type", "-t": "Flow", "Typescript" or "CodecIoTs",
"--exitOnInvalidType", "-e": block the execution of the programs if there are errors on the swagger,
"--patchSource", "-e":  url or path of the patch. The patch is a file whose content is merged with the swagger

Running the tests

npm run test

Built With

  • fp-ts - Used as functional programming library

Using the issue tracker

The issue tracker is the preferred channel for bug reports and features requests.

Package Sidebar

Install

npm i @musement/types-generator

Weekly Downloads

248

Version

0.0.13

License

ISC

Unpacked Size

90.4 kB

Total Files

61

Last publish

Collaborators

  • marcozi