Giter Site home page Giter Site logo

gencode4swagger's Introduction

generateService(schemaPath, config) ⇒ Promise.<void>

根据提供的 schema 和配置生成服务文件。

Kind: global function
Returns: Promise.<void> -

  • 返回一个 Promise,当所有操作完成时 resolve。
Param Type Description
schemaPath string

schema 的路径。

config ConfigOptions

配置选项。

config.templateDir string

模板目录的路径。

config.outputPath string

输出目录的路径。

config.prefix string

api 的前缀。

config.pathReg string

对路径进行正则判断,不符合的路径不生成。

config.ignore Array.<string>

忽略的路径列表。

config.dir string

生成的 api 文件的目录。

config.requestStr string

请求方法代码,默认为import request from '@/utils/request';

config.mode 'ts' | 'js'

生成文件的模式('ts' 或 'js')。

Example

// generateService 的使用示例
generateService('schemaPath', {
  templateDir: 'path/to/template',
  outputPath: 'path/to/output',
  prefix: 'api',
  ignore: ['ignore1', 'ignore2'],
  dir: 'api',
  mode: 'ts'
});

gencode4swagger's People

Contributors

actions-user avatar x007xyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.