Types generator is a Typescript project that allows to generate types for Typescript or Flow starting from a Swagger/OpenAPI document.
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
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
"--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
npm run test
- fp-ts - Used as functional programming library
The issue tracker is the preferred channel for bug reports
and features requests
.