@toft-code/swagger-axios-ts-generator
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@toft-code/swagger-axios-ts-generator

npm version

Install

$ npm install @toft-code/swagger-axios-ts-generator
$ yarn add @toft-code/swagger-axios-ts-generator

Example

Example Link

TypeScript

import { generate } from '@toft-code/swagger-axios-ts-generator'

generate({
  // out files path
  out: './testServices',

  // service name suffix
  serviceNameSuffix: 'Service',

  // api json url
  url:
    'https://raw.githubusercontent.com/toft-code/swagger-axios-ts-generator/master/test.json',

  // foreach operationId
  operationIdForeach: (operationId: string) => {
    return operationId.match(/[a-zA-Z]+/g)?.join('') ?? operationId
  },

  // services/index.ts template
  requestTemplateUrl:
    'https://raw.githubusercontent.com/toft-tech/swagger-axios-ts-generator/master/src/template/indexAxiosTemplate.ts',
})

CommonJS

const { generate } = require('@toft-code/swagger-axios-ts-generator')

generate({
  out: './src/testService',
  url:
    'https://raw.githubusercontent.com/toft-code/swagger-axios-ts-generator/master/test.json',
})

Other

Thanks Manweill/swagger-axios-codegen

Package Sidebar

Install

npm i @toft-code/swagger-axios-ts-generator

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

183 kB

Total Files

103

Last publish

Collaborators

  • limichange