Merge pull request #45 from lizhen789/master

添加请求和响应示例的开关配置项
This commit is contained in:
shalousun 2020-07-13 13:45:57 +08:00 committed by GitHub
commit 0bcd1ea31e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 664 additions and 639 deletions

View File

@ -106,6 +106,8 @@ public class DocBuilderTemplate extends BaseDocBuilderTemplate {
tpl.binding(TemplateVariable.VERSION.getVariable(), now);
tpl.binding(TemplateVariable.CREATE_TIME.getVariable(), strTime);
tpl.binding(TemplateVariable.PROJECT_NAME.getVariable(), config.getProjectName());
tpl.binding(TemplateVariable.REQUEST_EXAMPLE.getVariable(), config.isRequestExample());
tpl.binding(TemplateVariable.RESPONSE_EXAMPLE.getVariable(), config.isResponseExample());
if (CollectionUtil.isEmpty(errorCodeList)) {
tpl.binding(TemplateVariable.DICT_ORDER.getVariable(), apiDocList.size() + 1);
} else {

View File

@ -1,62 +1,62 @@
/*
* smart-doc https://github.com/shalousun/smart-doc
*
* Copyright (C) 2018-2020 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.power.doc.constants;
/**
* @author yu 2019/9/21.
*/
public enum TemplateVariable {
DESC("desc"),
NAME("name"),
LIST("list"),
API_DOC_LIST("apiDocList"),
ERROR_CODE_LIST("errorCodeList"),
VERSION_LIST("revisionLogList"),
DEPENDENCY_LIST("dependencyList"),
HOME_PAGE("homePage"),
HTML("html"),
TITLE("title"),
ERROR_LIST_TITLE("errorListTitle"),
CREATE_TIME("createTime"),
PROJECT_NAME("projectName"),
DICT_LIST("dictList"),
DICT_LIST_TITLE("dictListTitle"),
DICT_ORDER("dictListOrder"),
VERSION("version"),
PROTOCOL("protocol"),
AUTHOR("author"),
URI("uri"),
RPC_CONSUMER_CONFIG("consumerConfigExample")
;
private String variable;
TemplateVariable(String variable) {
this.variable = variable;
}
public String getVariable() {
return this.variable;
}
}
/*
* smart-doc https://github.com/shalousun/smart-doc
*
* Copyright (C) 2018-2020 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.power.doc.constants;
/**
* @author yu 2019/9/21.
*/
public enum TemplateVariable {
DESC("desc"),
NAME("name"),
LIST("list"),
API_DOC_LIST("apiDocList"),
ERROR_CODE_LIST("errorCodeList"),
VERSION_LIST("revisionLogList"),
DEPENDENCY_LIST("dependencyList"),
HOME_PAGE("homePage"),
HTML("html"),
TITLE("title"),
ERROR_LIST_TITLE("errorListTitle"),
CREATE_TIME("createTime"),
PROJECT_NAME("projectName"),
DICT_LIST("dictList"),
DICT_LIST_TITLE("dictListTitle"),
DICT_ORDER("dictListOrder"),
VERSION("version"),
PROTOCOL("protocol"),
AUTHOR("author"),
URI("uri"),
RPC_CONSUMER_CONFIG("consumerConfigExample"),
REQUEST_EXAMPLE("isRequestExample"),
RESPONSE_EXAMPLE("isResponseExample");
private String variable;
TemplateVariable(String variable) {
this.variable = variable;
}
public String getVariable() {
return this.variable;
}
}

View File

@ -1,451 +1,472 @@
/*
* smart-doc
*
* Copyright (C) 2018-2020 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.power.doc.model;
import com.power.common.util.CollectionUtil;
import com.power.doc.constants.DocLanguage;
import com.power.doc.model.rpc.RpcApiDependency;
import java.util.List;
import java.util.stream.Collectors;
/**
* Description:
* api config info
*
* @author yu 2018/06/18.
*/
public class ApiConfig {
/**
* Web server base url
*/
private String serverUrl;
/**
* Set comments check mode
*/
private boolean isStrict;
/**
* Merge all api doc into one document
*/
private boolean allInOne;
/**
* output path
*/
private String outPath;
/**
* source path
*/
private List<SourceCodePath> sourceCodePaths;
/**
* list of Request headers
*/
private List<ApiReqHeader> requestHeaders;
/**
* @since 1.7.5
* cover old all in one markdown
*/
private boolean coverOld;
/**
* list of custom response filed
*/
private List<CustomRespField> customResponseFields;
/**
* List of error code
*
* @return
*/
private List<ApiErrorCode> errorCodes;
/**
* controller package filters
*/
private String packageFilters;
/**
* List of change log
*/
private List<RevisionLog> revisionLogs;
/**
* @since 1.7+
*/
private boolean md5EncryptedHtmlName;
/**
* language support
*
* @since 1.7+
*/
private DocLanguage language;
/**
* adoc flag
*/
private boolean adoc;
/**
* api data dictionary
*/
private List<ApiDataDictionary> dataDictionaries;
/**
* @since 1.7.9
* api error code dictionary
*/
private List<ApiErrorCodeDictionary> errorCodeDictionaries;
/**
* list of custom response filed
*/
private List<ApiObjectReplacement> apiObjectReplacements;
/**
* list of rpc api dependencies
*/
private List<RpcApiDependency> rpcApiDependencies;
/**
* list of api constant
*/
private List<ApiConstant> apiConstants;
/**
* @since 1.7.5
* project name
*/
private String projectName;
/**
* Skip Transient Field
*/
private boolean skipTransientField = true;
/**
* @since 1.7.10
* default show author
*/
private boolean showAuthor = true;
/**
* convert request field to underline
*
* @since 1.8.7
*/
private boolean requestFieldToUnderline;
/**
* convert response field to underline
*
* @since 1.8.7
*/
private boolean responseFieldToUnderline;
/**
* sort by title
*
* @since 1.8.7
*/
private boolean sortByTitle;
/**
* is rest api doc
*
* @since 1.8.7
*/
private Boolean showJavaType = Boolean.FALSE;
/**
* is inline enum field comment
* @since 1.8.8
*/
private Boolean inlineEnum = Boolean.FALSE;
/**
* rpc consumer config example
* @since 1.8.7
*/
private String rpcConsumerConfig;
/**
* recursion limit
* @since 1.8.8
*/
private int recursionLimit = 7;
public String getServerUrl() {
return serverUrl;
}
public void setServerUrl(String serverUrl) {
this.serverUrl = serverUrl;
}
public boolean isStrict() {
return isStrict;
}
public void setStrict(boolean strict) {
isStrict = strict;
}
public String getOutPath() {
return outPath;
}
public void setOutPath(String outPath) {
this.outPath = outPath;
}
public List<ApiReqHeader> getRequestHeaders() {
return requestHeaders;
}
public void setRequestHeaders(ApiReqHeader... requestHeaders) {
this.requestHeaders = CollectionUtil.asList(requestHeaders);
this.requestHeaders.stream().map(header -> header.setDesc(header.getDesc() + "(Global)"))
.collect(Collectors.toList());
}
public List<CustomRespField> getCustomResponseFields() {
return customResponseFields;
}
public void setCustomResponseFields(CustomRespField... customResponseFields) {
this.customResponseFields = CollectionUtil.asList(customResponseFields);
}
public List<ApiErrorCode> getErrorCodes() {
return errorCodes;
}
public void setErrorCodes(List<ApiErrorCode> errorCodes) {
this.errorCodes = errorCodes;
}
public List<SourceCodePath> getSourceCodePaths() {
return sourceCodePaths;
}
public void setSourceCodePaths(SourceCodePath... sourcePaths) {
this.sourceCodePaths = CollectionUtil.asList(sourcePaths);
}
public boolean isAllInOne() {
return allInOne;
}
public void setAllInOne(boolean allInOne) {
this.allInOne = allInOne;
}
public String getPackageFilters() {
return packageFilters;
}
public void setPackageFilters(String packageFilters) {
this.packageFilters = packageFilters;
}
public List<RevisionLog> getRevisionLogs() {
return revisionLogs;
}
public void setRevisionLogs(RevisionLog... revisionLogs) {
this.revisionLogs = CollectionUtil.asList(revisionLogs);
}
public boolean isMd5EncryptedHtmlName() {
return md5EncryptedHtmlName;
}
public void setMd5EncryptedHtmlName(boolean md5EncryptedHtmlName) {
this.md5EncryptedHtmlName = md5EncryptedHtmlName;
}
public DocLanguage getLanguage() {
return language;
}
public void setLanguage(DocLanguage language) {
this.language = language;
}
public boolean isAdoc() {
return adoc;
}
public void setAdoc(boolean adoc) {
this.adoc = adoc;
}
public List<ApiDataDictionary> getDataDictionaries() {
return dataDictionaries;
}
public void setDataDictionaries(ApiDataDictionary... dataDictConfigs) {
this.dataDictionaries = CollectionUtil.asList(dataDictConfigs);
}
public ApiDataDictionary getDataDictionary(String enumClassSimpleName) {
return this.dataDictionaries.stream().filter((apiDataDictionary ->
enumClassSimpleName.equalsIgnoreCase(apiDataDictionary.getEnumClassName())))
.findFirst().orElse(new ApiDataDictionary());
}
public List<ApiErrorCodeDictionary> getErrorCodeDictionaries() {
return errorCodeDictionaries;
}
public void setErrorCodeDictionaries(ApiErrorCodeDictionary... errorCodeDictConfigs) {
this.errorCodeDictionaries = CollectionUtil.asList(errorCodeDictConfigs);
}
public List<ApiObjectReplacement> getApiObjectReplacements() {
return apiObjectReplacements;
}
public void setApiObjectReplacements(ApiObjectReplacement... apiObjectReplaces) {
this.apiObjectReplacements = CollectionUtil.asList(apiObjectReplaces);
}
public List<RpcApiDependency> getRpcApiDependencies() {
return rpcApiDependencies;
}
public void setRpcApiDependencies(RpcApiDependency... rpcApiDependencies) {
this.rpcApiDependencies = CollectionUtil.asList(rpcApiDependencies);
}
public List<ApiConstant> getApiConstants() {
return apiConstants;
}
public void setApiConstants(ApiConstant... apiConstants) {
this.apiConstants = CollectionUtil.asList(apiConstants);
}
public boolean isCoverOld() {
return coverOld;
}
public void setCoverOld(boolean coverOld) {
this.coverOld = coverOld;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public boolean isSkipTransientField() {
return skipTransientField;
}
public void setSkipTransientField(boolean skipTransientField) {
this.skipTransientField = skipTransientField;
}
public boolean isShowAuthor() {
return showAuthor;
}
public void setShowAuthor(boolean showAuthor) {
this.showAuthor = showAuthor;
}
public boolean isRequestFieldToUnderline() {
return requestFieldToUnderline;
}
public void setRequestFieldToUnderline(boolean requestFieldToUnderline) {
this.requestFieldToUnderline = requestFieldToUnderline;
}
public boolean isResponseFieldToUnderline() {
return responseFieldToUnderline;
}
public void setResponseFieldToUnderline(boolean responseFieldToUnderline) {
this.responseFieldToUnderline = responseFieldToUnderline;
}
public boolean isSortByTitle() {
return sortByTitle;
}
public void setSortByTitle(boolean sortByTitle) {
this.sortByTitle = sortByTitle;
}
public Boolean getShowJavaType() {
return showJavaType;
}
public void setShowJavaType(Boolean showJavaType) {
this.showJavaType = showJavaType;
}
public String getRpcConsumerConfig() {
return rpcConsumerConfig;
}
public void setRpcConsumerConfig(String rpcConsumerConfig) {
this.rpcConsumerConfig = rpcConsumerConfig;
}
public Boolean getInlineEnum() {
return inlineEnum;
}
public void setInlineEnum(Boolean inlineEnum) {
this.inlineEnum = inlineEnum;
}
public int getRecursionLimit() {
return recursionLimit;
}
public void setRecursionLimit(int recursionLimit) {
this.recursionLimit = recursionLimit;
}
}
/*
* smart-doc
*
* Copyright (C) 2018-2020 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.power.doc.model;
import com.power.common.util.CollectionUtil;
import com.power.doc.constants.DocLanguage;
import com.power.doc.model.rpc.RpcApiDependency;
import java.util.List;
import java.util.stream.Collectors;
/**
* Description:
* api config info
*
* @author yu 2018/06/18.
*/
public class ApiConfig {
/**
* Web server base url
*/
private String serverUrl;
/**
* Set comments check mode
*/
private boolean isStrict;
/**
* Merge all api doc into one document
*/
private boolean allInOne;
/**
* output path
*/
private String outPath;
/**
* source path
*/
private List<SourceCodePath> sourceCodePaths;
/**
* list of Request headers
*/
private List<ApiReqHeader> requestHeaders;
/**
* @since 1.7.5
* cover old all in one markdown
*/
private boolean coverOld;
/**
* list of custom response filed
*/
private List<CustomRespField> customResponseFields;
/**
* List of error code
*
* @return
*/
private List<ApiErrorCode> errorCodes;
/**
* controller package filters
*/
private String packageFilters;
/**
* List of change log
*/
private List<RevisionLog> revisionLogs;
/**
* @since 1.7+
*/
private boolean md5EncryptedHtmlName;
/**
* language support
*
* @since 1.7+
*/
private DocLanguage language;
/**
* adoc flag
*/
private boolean adoc;
/**
* api data dictionary
*/
private List<ApiDataDictionary> dataDictionaries;
/**
* @since 1.7.9
* api error code dictionary
*/
private List<ApiErrorCodeDictionary> errorCodeDictionaries;
/**
* list of custom response filed
*/
private List<ApiObjectReplacement> apiObjectReplacements;
/**
* list of rpc api dependencies
*/
private List<RpcApiDependency> rpcApiDependencies;
/**
* list of api constant
*/
private List<ApiConstant> apiConstants;
/**
* @since 1.7.5
* project name
*/
private String projectName;
/**
* Skip Transient Field
*/
private boolean skipTransientField = true;
/**
* @since 1.7.10
* default show author
*/
private boolean showAuthor = true;
/**
* convert request field to underline
*
* @since 1.8.7
*/
private boolean requestFieldToUnderline;
/**
* convert response field to underline
*
* @since 1.8.7
*/
private boolean responseFieldToUnderline;
/**
* sort by title
*
* @since 1.8.7
*/
private boolean sortByTitle;
/**
* is rest api doc
*
* @since 1.8.7
*/
private Boolean showJavaType = Boolean.FALSE;
/**
* is inline enum field comment
* @since 1.8.8
*/
private Boolean inlineEnum = Boolean.FALSE;
/**
* rpc consumer config example
* @since 1.8.7
*/
private String rpcConsumerConfig;
/**
* recursion limit
* @since 1.8.8
*/
private int recursionLimit = 7;
/**
* request example
*/
private boolean isRequestExample;
/**
* response example
*/
private boolean isResponseExample;
public String getServerUrl() {
return serverUrl;
}
public void setServerUrl(String serverUrl) {
this.serverUrl = serverUrl;
}
public boolean isStrict() {
return isStrict;
}
public void setStrict(boolean strict) {
isStrict = strict;
}
public String getOutPath() {
return outPath;
}
public void setOutPath(String outPath) {
this.outPath = outPath;
}
public List<ApiReqHeader> getRequestHeaders() {
return requestHeaders;
}
public void setRequestHeaders(ApiReqHeader... requestHeaders) {
this.requestHeaders = CollectionUtil.asList(requestHeaders);
this.requestHeaders.stream().map(header -> header.setDesc(header.getDesc() + "(Global)"))
.collect(Collectors.toList());
}
public List<CustomRespField> getCustomResponseFields() {
return customResponseFields;
}
public void setCustomResponseFields(CustomRespField... customResponseFields) {
this.customResponseFields = CollectionUtil.asList(customResponseFields);
}
public List<ApiErrorCode> getErrorCodes() {
return errorCodes;
}
public void setErrorCodes(List<ApiErrorCode> errorCodes) {
this.errorCodes = errorCodes;
}
public List<SourceCodePath> getSourceCodePaths() {
return sourceCodePaths;
}
public void setSourceCodePaths(SourceCodePath... sourcePaths) {
this.sourceCodePaths = CollectionUtil.asList(sourcePaths);
}
public boolean isAllInOne() {
return allInOne;
}
public void setAllInOne(boolean allInOne) {
this.allInOne = allInOne;
}
public String getPackageFilters() {
return packageFilters;
}
public void setPackageFilters(String packageFilters) {
this.packageFilters = packageFilters;
}
public List<RevisionLog> getRevisionLogs() {
return revisionLogs;
}
public void setRevisionLogs(RevisionLog... revisionLogs) {
this.revisionLogs = CollectionUtil.asList(revisionLogs);
}
public boolean isMd5EncryptedHtmlName() {
return md5EncryptedHtmlName;
}
public void setMd5EncryptedHtmlName(boolean md5EncryptedHtmlName) {
this.md5EncryptedHtmlName = md5EncryptedHtmlName;
}
public DocLanguage getLanguage() {
return language;
}
public void setLanguage(DocLanguage language) {
this.language = language;
}
public boolean isAdoc() {
return adoc;
}
public void setAdoc(boolean adoc) {
this.adoc = adoc;
}
public List<ApiDataDictionary> getDataDictionaries() {
return dataDictionaries;
}
public void setDataDictionaries(ApiDataDictionary... dataDictConfigs) {
this.dataDictionaries = CollectionUtil.asList(dataDictConfigs);
}
public ApiDataDictionary getDataDictionary(String enumClassSimpleName) {
return this.dataDictionaries.stream().filter((apiDataDictionary ->
enumClassSimpleName.equalsIgnoreCase(apiDataDictionary.getEnumClassName())))
.findFirst().orElse(new ApiDataDictionary());
}
public List<ApiErrorCodeDictionary> getErrorCodeDictionaries() {
return errorCodeDictionaries;
}
public void setErrorCodeDictionaries(ApiErrorCodeDictionary... errorCodeDictConfigs) {
this.errorCodeDictionaries = CollectionUtil.asList(errorCodeDictConfigs);
}
public List<ApiObjectReplacement> getApiObjectReplacements() {
return apiObjectReplacements;
}
public void setApiObjectReplacements(ApiObjectReplacement... apiObjectReplaces) {
this.apiObjectReplacements = CollectionUtil.asList(apiObjectReplaces);
}
public List<RpcApiDependency> getRpcApiDependencies() {
return rpcApiDependencies;
}
public void setRpcApiDependencies(RpcApiDependency... rpcApiDependencies) {
this.rpcApiDependencies = CollectionUtil.asList(rpcApiDependencies);
}
public List<ApiConstant> getApiConstants() {
return apiConstants;
}
public void setApiConstants(ApiConstant... apiConstants) {
this.apiConstants = CollectionUtil.asList(apiConstants);
}
public boolean isCoverOld() {
return coverOld;
}
public void setCoverOld(boolean coverOld) {
this.coverOld = coverOld;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public boolean isSkipTransientField() {
return skipTransientField;
}
public void setSkipTransientField(boolean skipTransientField) {
this.skipTransientField = skipTransientField;
}
public boolean isShowAuthor() {
return showAuthor;
}
public void setShowAuthor(boolean showAuthor) {
this.showAuthor = showAuthor;
}
public boolean isRequestFieldToUnderline() {
return requestFieldToUnderline;
}
public void setRequestFieldToUnderline(boolean requestFieldToUnderline) {
this.requestFieldToUnderline = requestFieldToUnderline;
}
public boolean isResponseFieldToUnderline() {
return responseFieldToUnderline;
}
public void setResponseFieldToUnderline(boolean responseFieldToUnderline) {
this.responseFieldToUnderline = responseFieldToUnderline;
}
public boolean isSortByTitle() {
return sortByTitle;
}
public void setSortByTitle(boolean sortByTitle) {
this.sortByTitle = sortByTitle;
}
public Boolean getShowJavaType() {
return showJavaType;
}
public void setShowJavaType(Boolean showJavaType) {
this.showJavaType = showJavaType;
}
public String getRpcConsumerConfig() {
return rpcConsumerConfig;
}
public void setRpcConsumerConfig(String rpcConsumerConfig) {
this.rpcConsumerConfig = rpcConsumerConfig;
}
public Boolean getInlineEnum() {
return inlineEnum;
}
public void setInlineEnum(Boolean inlineEnum) {
this.inlineEnum = inlineEnum;
}
public int getRecursionLimit() {
return recursionLimit;
}
public void setRecursionLimit(int recursionLimit) {
this.recursionLimit = recursionLimit;
}
public boolean isRequestExample() {
return isRequestExample;
}
public void setRequestExample(boolean requestExample) {
isRequestExample = requestExample;
}
public boolean isResponseExample() {
return isResponseExample;
}
public void setResponseExample(boolean responseExample) {
isResponseExample = responseExample;
}
}

View File

@ -8,6 +8,8 @@
"md5EncryptedHtmlName": false,
"projectName": "smart-doc",
"skipTransientField": true,
"isRequestExample": true,
"isResponseExample": true,
"revisionLogs": [
{
"version": "1.0",
@ -47,4 +49,4 @@
"desc": "测试"
}
]
}
}

View File

@ -64,7 +64,7 @@ for(param in doc.requestParams){
|====================
<%}%>
<%if(isNotEmpty(doc.requestUsage)){%>
<%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>
*Request-example:*
----
${doc.requestUsage}
@ -85,7 +85,7 @@ for(param in doc.responseParams){
|====================
<%}%>
<%if(isNotEmpty(doc.responseUsage)){%>
<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>
*Response-example:*
----
${doc.responseUsage}
@ -127,4 +127,4 @@ for(dataDict in dict.dataDictList){
<%}%>
|====================
<%}%>
<%}%>
<%}%>

View File

@ -1,113 +1,113 @@
<%if(isNotEmpty(projectName)){%>
# ${projectName}
<%}%>
<%if(isNotEmpty(revisionLogList)){%>
Version | Update Time | Status | Author | Description
---|---|---|---|---
<%
for(revisionLog in revisionLogList){
%>
${revisionLog.version}|${revisionLog.revisionTime}|${revisionLog.status}|${revisionLog.author}|${revisionLog.remarks}
<%}%>
<%}%>
<%
for(api in apiDocList){
%>
## ${api.desc}
<%
for(doc in api.list){
%>
<%if(doc.deprecated){%>
### ~~${doc.desc}~~
<%}else{%>
### ${doc.desc}
<%}%>
**URL:** ${doc.url}
**Type:** ${doc.type}
<%if(isNotEmpty(doc.author)){%>
**Author:** ${doc.author}
<%}%>
**Content-Type:** ${doc.contentType}
**Description:** ${doc.detail}
<%if(isNotEmpty(doc.headers)){%>
**Request-headers:**
Header | Type|Description|Required|Since
---|---|---|---|----
${doc.headers}
<%}%>
<%if(isNotEmpty(doc.requestParams)){%>
**Request-parameters:**
Parameter | Type|Description|Required|Since
---|---|---|---|---
<%
for(param in doc.requestParams){
%>
${param.field}|${param.type}|${param.desc}|${param.required}|${param.version}
<%}%>
<%}%>
<%if(isNotEmpty(doc.requestUsage)){%>
**Request-example:**
```
${doc.requestUsage}
```
<%}%>
<%if(isNotEmpty(doc.responseParams)){%>
**Response-fields:**
Field | Type|Description|Since
---|---|---|---
<%
for(param in doc.responseParams){
%>
${param.field}|${param.type}|${param.desc}|${param.version}
<%}%>
<%}%>
<%if(isNotEmpty(doc.responseUsage)){%>
**Response-example:**
```
${doc.responseUsage}
```
<%}%>
<% } %>
<% } %>
<%if(isNotEmpty(errorCodeList)){%>
## ${errorListTitle}
Error code |Description
---|---
<%
for(error in errorCodeList){
%>
${error.value}|${error.desc}
<%}%>
<%}%>
<%if(isNotEmpty(dictList)){%>
## ${dictListTitle}
<%
for(dict in dictList){
%>
### ${dict.title}
Code |Type|Description
---|---|---
<%
for(dataDict in dict.dataDictList){
%>
${dataDict.value}|${dataDict.type}|${dataDict.desc}
<%}%>
<%}%>
<%}%>
<%if(isNotEmpty(projectName)){%>
# ${projectName}
<%}%>
<%if(isNotEmpty(revisionLogList)){%>
Version | Update Time | Status | Author | Description
---|---|---|---|---
<%
for(revisionLog in revisionLogList){
%>
${revisionLog.version}|${revisionLog.revisionTime}|${revisionLog.status}|${revisionLog.author}|${revisionLog.remarks}
<%}%>
<%}%>
<%
for(api in apiDocList){
%>
## ${api.desc}
<%
for(doc in api.list){
%>
<%if(doc.deprecated){%>
### ~~${doc.desc}~~
<%}else{%>
### ${doc.desc}
<%}%>
**URL:** ${doc.url}
**Type:** ${doc.type}
<%if(isNotEmpty(doc.author)){%>
**Author:** ${doc.author}
<%}%>
**Content-Type:** ${doc.contentType}
**Description:** ${doc.detail}
<%if(isNotEmpty(doc.headers)){%>
**Request-headers:**
Header | Type|Description|Required|Since
---|---|---|---|----
${doc.headers}
<%}%>
<%if(isNotEmpty(doc.requestParams)){%>
**Request-parameters:**
Parameter | Type|Description|Required|Since
---|---|---|---|---
<%
for(param in doc.requestParams){
%>
${param.field}|${param.type}|${param.desc}|${param.required}|${param.version}
<%}%>
<%}%>
<%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>
**Request-example:**
```
${doc.requestUsage}
```
<%}%>
<%if(isNotEmpty(doc.responseParams)){%>
**Response-fields:**
Field | Type|Description|Since
---|---|---|---
<%
for(param in doc.responseParams){
%>
${param.field}|${param.type}|${param.desc}|${param.version}
<%}%>
<%}%>
<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>
**Response-example:**
```
${doc.responseUsage}
```
<%}%>
<% } %>
<% } %>
<%if(isNotEmpty(errorCodeList)){%>
## ${errorListTitle}
Error code |Description
---|---
<%
for(error in errorCodeList){
%>
${error.value}|${error.desc}
<%}%>
<%}%>
<%if(isNotEmpty(dictList)){%>
## ${dictListTitle}
<%
for(dict in dictList){
%>
### ${dict.title}
Code |Type|Description
---|---|---
<%
for(dataDict in dict.dataDictList){
%>
${dataDict.value}|${dataDict.type}|${dataDict.desc}
<%}%>
<%}%>
<%}%>

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,7 @@ for(param in doc.requestParams){
<%}%>
|====================
<%if(isNotEmpty(doc.requestUsage)){%>
<%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>
*Request-example:*
----
${doc.requestUsage}
@ -67,7 +67,7 @@ for(param in doc.responseParams){
<%}%>
|====================
<%if(isNotEmpty(doc.responseUsage)){%>
<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>
*Response-example:*
----
${doc.responseUsage}

View File

@ -40,7 +40,7 @@ ${param.field}|${param.type}|${param.desc}|${param.required}|${param.version}
<%}%>
<%}%>
<%if(isNotEmpty(doc.requestUsage)){%>
<%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>
**Request-example:**
```
${doc.requestUsage}
@ -58,7 +58,7 @@ ${param.field}|${param.type}|${param.desc}|${param.version}
<%}%>
<%}%>
<%if(isNotEmpty(doc.responseUsage)){%>
<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>
**Response-example:**
```
${doc.responseUsage}

View File

@ -91,7 +91,7 @@
</tbody>
</table>
<%}%>
<%if(isNotEmpty(doc.requestUsage)){%>
<%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>
<p><strong>Request-example:</strong></p>
<pre><code>${doc.requestUsage}
</code></pre>
@ -113,7 +113,7 @@
</table>
<%}%>
<%if(isNotEmpty(doc.responseUsage)){%>
<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>
<p><strong>Response-example:</strong></p>
<pre><code>${doc.responseUsage}
</code></pre>
@ -132,4 +132,4 @@
</div>
</div>
</body>
</html>
</html>