swatts
TypeScript icon, indicating that this package has built-in type declarations

0.2.0-beta.2 • Public • Published

npm

npm i swatts
# or 
yarn add swatts

Usage

import swatts from 'swatts';
 
swatts({
  API: 'http://YOUR-DOMAIN.wtf/swagger/v1/swagger.json',
  regexpMethods: {
    nameInterface?: /(Container|ExtensionTotal)\[(.*)/, // swagger v2
    matchInterfaceName?: /definitions\/(\w+)/, // swagger v2
    excludeDTO: /(RequestDto|ExtensionEmpty)/, 
    replaceSpace: /^\s*[\r\n]/gm,
  },
  modificators: {
    interfaceReplace?: { StatedContainerDto: 'any', 'StatedContainerDto[]': 'any[]' },
    typeReplace: { 'integer': 'number' }
  },
  filePath: __dirname + '/types.ts'
})

Example file

export enum EnumUserRole {
  administrator = 'administrator', // admin
  organizationOwner = 'organizationOwner', // org
}
export interface ProfileDto {
  profileID: number; // ProfileID
  timeZone: string; // TimeZone
  firstName: string; // First name
  lastName: string; // Last name
  email: string; // Email
  userRole: EnumUserRole;
}

/swatts/

    Package Sidebar

    Install

    npm i swatts

    Weekly Downloads

    3

    Version

    0.2.0-beta.2

    License

    MIT

    Unpacked Size

    28.2 kB

    Total Files

    22

    Last publish

    Collaborators

    • stk-dmitry