maven 加入 插件
<build>
<plugin>
<groupId>com.ly.smart-doc</groupId>
<artifactId>smart-doc-maven-plugin</artifactId>
<version>3.0.5</version>
</plugin>
</plugins>
</build>
ant 通过mvn 执行smart-doc
<target name="docTornaTest">
<exec executable="mvn.cmd">
<arg value="-DconfigFile=smart-doc/smart-test.json" />
<arg value="-DprojectName=临时系统" />
<arg value="smart-doc:torna-rest" />
</exec>
</target>
smart-doc json 配置
{
"serverUrl": "127.0.0.1:8081",
"allInOne": true,
"isStrict": false,
"coverOld": true,
"framework": "solon",
"outPath": "smart-doc/doc",
"recursionLimit": 7,
"requestExample": "true",
"responseExample": "true",
"openUrl": "http://localhost:7700/api",
"appToken": "fe5ecfaa177945e6a5d13148b00a0800",
"debugEnvName": "本地环境",
"debugEnvUrl": "http://192.168.0.24:8081",
"tornaDebug": true,
"replace": true,
"revisionLogs": [
{
"version": "1.0",
"status": "use",
"author": "ma",
"revisionTime": "2024-06-07 17:29:03",
"remarks": "测试"
},
{
"version": "1.1",
"status": "use",
"author": "ma",
"revisionTime": "2024-06-17 17:29:03",
"remarks": "测试更新"
}
],
"errorCodeDictionaries": [
{
"title": "title",
"enumClassName": "com.account.common.ErrorCode",
"codeField": "code",
"descField": "msg"
}
],
"dataDictionaries": [
{
"title": "PlatFormType",
"enumClassName": "com.account.common.PlatformType",
"codeField": "id",
"descField": "name"
}
],
"customResponseFields": [
{
"name": "name",
"desc": "desc",
"ownerClassName": "com.newticee.sys.account.common.Result",
"value": "value"
}
],
"packageFilters": "com.account.controller.StartController.start*",
"requestHeaders": [
{
"name": "authorization",
"type": "string",
"desc": "系统使用",
"required": true,
"since": "1.0",
"excludePathPatterns": "/user/loginAccount,/user/vipList,/out/**,/start/**"
}
]
}
部分配置理解
- packageFilters 配置过滤controller,结尾加* 可以过滤method
- customResponseFields 通用返回类
- dataDictionaries 字典
- errorCodeDictionaries 错误码
- requestHeaders 请求头设置