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

0.1.39 • Public • Published

openapi-generator

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Quick View

openapi-generator from swagger 2.0 or OpenAPI 3.0:

Simple

openapi-generator url http://xxx/v2/api-docs -c true

Use Config

openapi-generator config ./xxx.js or openapi-generator config ./xxx.json

Config interface:

interface CliConfig {
  api: string;
 
  /** dir for openapi-generator */
  sdkDir: string;
  /** path of service template */
  templatePath?: string;
  /** path of interface template */
  interfaceTemplatePath?: string;
  /** request lib */
  requestLib = true;
  /** filename style, true 为大驼峰,lower 为小驼峰 */
  camelCase?: boolean | 'lower' = false;
  /** gen type */
  type?: 'ts' | 'js' = 'ts';
  /** service type */
  serviceType?: 'function' | 'class' = 'function';
  /** namespace of typings */
  namespace?: string = 'API';
  /** 自动清除旧文件时忽略列表 */
  ignoreDelete: string[] = [];
}

genAPISDK

function genAPISDK(data: RouteMetadataType[], config: GenConfig) => void

Readme

Keywords

none

Package Sidebar

Install

npm i openapi-generator

Weekly Downloads

3,067

Version

0.1.39

License

MIT

Unpacked Size

66.4 kB

Total Files

40

Last publish

Collaborators

  • zhang740