swagger-js-codegen-template-typescript-fetch

1.1.0 • Public • Published

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.

License

Apache 2.0

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i swagger-js-codegen-template-typescript-fetch

      Weekly Downloads

      1

      Version

      1.1.0

      License

      Apache 2.0

      Last publish

      Collaborators

      • strothj