1.0.20 • Published 1 month ago
auto-apis v1.0.20
Auto Apis CLI
基于 Easy Mock Cli 改造,用于和后端swagger配合快速生成 API
调用文件。
使用方式
- bin目录下包含node可以直接启动的脚本,直接配置在项目中启动即可
- 项目目录下包含一个项目swagger-ui的地址配置,文件名为
.auto-apis.js
,用于获取接口,内容如下
/**
* Created by ArvinChen9539 on 2021/8/19.
* auto-apis 配置示例文件
*/
module.exports = {
//可空,接口文件存放位置
output: 'src/api',
//可空,swagger类型相关文件
outputType: 'src/types',
//可空,是否开启入参格式校验
checkParams: true,
//可空,类型文件输出
isOutputType: true,
//可空
namespaceConfig: {
Components: 'ServiceType',
Paths: 'ServiceTypePaths'
},
projects: [
{
name: 'aged-admin',
//新搬swagger3没有上下文,需要时手动设置一下
contentPath:'/aged-admin',
id: 'http://10.0.2.198:8360/aged-admin/v3/api-docs?group=api'
}
]
}
- 执行命令生成文件
node ./node_modules/auto-apis/bin/auto-apis-init.js
服务端java代码
/exampleJava/Swagger2Java.java