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.VERSION.getVariable(), now);
tpl.binding(TemplateVariable.CREATE_TIME.getVariable(), strTime); tpl.binding(TemplateVariable.CREATE_TIME.getVariable(), strTime);
tpl.binding(TemplateVariable.PROJECT_NAME.getVariable(), config.getProjectName()); 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)) { if (CollectionUtil.isEmpty(errorCodeList)) {
tpl.binding(TemplateVariable.DICT_ORDER.getVariable(), apiDocList.size() + 1); tpl.binding(TemplateVariable.DICT_ORDER.getVariable(), apiDocList.size() + 1);
} else { } else {

View File

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

View File

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

View File

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

View File

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

View File

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