swagger-js-codegen-template-typescript-fetch
v1.1.0
Published
TypeScript fetch template for swagger-js-codegen
Downloads
3
Readme
swagger-js-codegen-template-typescript-fetch
These are templates for use with the project swagger-js-codegen.
They are used to generate a client which relies on the fetch
browser api.
Installation
Requirements
- npm or yarn
$ npm install --save-dev swagger-js-codegen-template-typescript-fetch
or
$ yarn add --dev swagger-js-codegen-template-typescript-fetch
Usage
const template = [
"class",
"definition",
"method",
"type"
].reduce((acc, name) => {
acc[name] = fs.readFileSync(
path.resolve(__dirname, `../node_modules/swagger-js-codegen-template-typescript-fetch/${name}.mustache`),
"utf-8"
);
return acc;
}, {});
const source = Codegen.getCustomCode({
className: "Api",
swagger: spec,
template
});
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.