diff --git a/src/main/resources/template/AllInOne.adoc b/src/main/resources/template/AllInOne.adoc index dd012ba1b..427b2baf3 100644 --- a/src/main/resources/template/AllInOne.adoc +++ b/src/main/resources/template/AllInOne.adoc @@ -45,14 +45,18 @@ for(doc in api.list){ *Content-Type:* `${doc.contentType}` -<%if(isNotEmpty(doc.headers)){%> +<%if(isNotEmpty(doc.requestHeaders)){%> *Request-headers:* [width="100%",options="header"] [stripes=even] |==================== -|Header | Type|Required|Description|Since -${doc.headers} +|Header | Type|Required|Description|Since|Example +<% +for(param in doc.requestHeaders){ +%> +|${param.name}|${param.type}|${param.required}|${param.desc}|${param.since}|${param.value} +<%}%> |==================== <%}%> @@ -62,11 +66,11 @@ ${doc.headers} [width="100%",options="header"] [stripes=even] |==================== -|Parameter | Type|Required|Description|Since +|Parameter | Type|Required|Description|Since|Example <% for(param in doc.pathParams){ %> -|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> @@ -77,11 +81,11 @@ for(param in doc.pathParams){ [width="100%",options="header"] [stripes=even] |==================== -|Parameter | Type|Required|Description|Since +|Parameter | Type|Required|Description|Since|Example <% for(param in doc.queryParams){ %> -|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> @@ -92,11 +96,11 @@ for(param in doc.queryParams){ [width="100%",options="header"] [stripes=even] |==================== -|Parameter | Type|Required|Description|Since +|Parameter | Type|Required|Description|Since|Example <% for(param in doc.requestParams){ %> -|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> @@ -113,11 +117,11 @@ ${doc.requestUsage} [width="100%",options="header"] [stripes=even] |==================== -|Field | Type|Description|Since +|Field | Type|Description|Since|Example <% for(param in doc.responseParams){ %> -|${param.field}|${param.type}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> diff --git a/src/main/resources/template/AllInOne.html b/src/main/resources/template/AllInOne.html index bc044af71..250641d2c 100644 --- a/src/main/resources/template/AllInOne.html +++ b/src/main/resources/template/AllInOne.html @@ -1 +1,438 @@ -<%if(isNotEmpty(projectName)){%>${projectName}<%}else{%>API Reference<%}%><%if(isNotEmpty(highlightCssLink)){%><%}%>
<%if(isNotEmpty(revisionLogList)){%>
<%for(revisionLog in revisionLogList){%><%}%>
VersionUpdate TimeStatusAuthorDescription

${revisionLog.version}

${revisionLog.revisionTime}

${revisionLog.status}

${revisionLog.author}

${htmlEscape(revisionLog.remarks)}

<%}%><%for(apiGroup in apiDocList){%><%if(!apiDocListOnlyHasDefaultGroup){%>

${apiGroup.order}.${htmlEscape(apiGroup.name)}

<%}%><%for(api in apiGroup.childrenApiDocs){%>

<%if(apiGroupLP.size>1){%>${apiGroup.order}.${api.order}.${htmlEscape(api.desc)}<%}else{%>${api.order}.${htmlEscape(api.desc)}<%}%>

<%for(doc in api.list){%>

<%if(doc.deprecated){%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.<%}else{%>${api.order}.${doc.order}.<%}%>${htmlEscape(doc.desc)}<%}else{%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}else{%>${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}%><%}%>

Type: ${doc.type}

<%if(isNotEmpty(doc.author)){%>

Author: ${doc.author}

<%}%>

Content-Type: ${doc.contentType}

Description: ${htmlEscape(doc.detail)}

<%if(isNotEmpty(doc.requestHeaders)&&displayRequestParams){%>

Request-headers:

<%for(header in doc.requestHeaders){%><%}%>
HeaderTypeDescriptionRequiredSince

${header.name}

${header.type}

${htmlEscape(header.desc)}

${header.required}

${header.since}

<%}%><%if(isNotEmpty(doc.pathParams)&&displayRequestParams){%>

Path-parameters:

<%for(param in doc.pathParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.queryParams)&&displayRequestParams){%>

Query-parameters:

<%for(param in doc.queryParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestParams)&&displayRequestParams){%>

Body-parameters:

<%for(param in doc.requestParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>

Request-example:

${doc.requestUsage}
<%}%><%if(isNotEmpty(doc.responseParams)&&displayResponseParams){%>

Response-fields:

<%for(param in doc.responseParams){%><%}%>
FieldTypeDescriptionSince

${param.field}

${param.type}

${param.desc}

${param.version}

<%}%><%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>

Response-example:

${doc.responseUsage}
<%}%>
<%}%>
<%}%><%}%><%if(isNotEmpty(errorCodeList)){%>

${errorCodeListOrder}.${errorListTitle}

<%for(error in errorCodeList){%><%}%>
Error codeDescription

${error.value}

${htmlEscape(error.desc)}

<%}%><%if(isNotEmpty(dictList)){%>

${dictListOrder}.${dictListTitle}

<%for(dict in dictList){%>

${dictListOrder}.${dict.order}.${htmlEscape(dict.title)}

<%for(dataDict in dict.dataDictList){%><%}%>
NameCodeTypeDescription

${dataDict.name}

${dataDict.value}

${dataDict.type}

${htmlEscape(dataDict.desc)}

<%}%>
<%}%>
Top
\ No newline at end of file + + + + + + + <%if(isNotEmpty(projectName)){%>${projectName}<%}else{%>API Reference<%}%> + + + <%if(isNotEmpty(highlightCssLink)){%> + + <%}%> + + + + + + +
<%if(isNotEmpty(revisionLogList)){%> +
+
+ + + + + + + + + + + + + + + + + + <%for(revisionLog in revisionLogList){%> + + + + + + + + <%}%> + +
VersionUpdate TimeStatusAuthorDescription

${revisionLog.version}

${revisionLog.revisionTime}

${revisionLog.status}

${revisionLog.author}

${htmlEscape(revisionLog.remarks)}

+
+
+
+ <%}%><%for(apiGroup in apiDocList){%><%if(!apiDocListOnlyHasDefaultGroup){%>

${apiGroup.order}.${htmlEscape(apiGroup.name)}

+ <%}%><%for(api in apiGroup.childrenApiDocs){%> +

<%if(apiGroupLP.size>1){%>${apiGroup.order}.${api.order}.${htmlEscape(api.desc)}<%}else{%>${api.order}.${htmlEscape(api.desc)}<%}%> +

+
<%for(doc in api.list){%> +

<%if(doc.deprecated){%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.<%}else{%>${api.order}.${doc.order}.<%}%>${htmlEscape(doc.desc)}<%}else{%><%if(!apiDocListOnlyHasDefaultGroup){%>${apiGroup.order}.${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}else{%>${api.order}.${doc.order}.${htmlEscape(doc.desc)}<%}%><%}%> +

+ +

Type: ${doc.type} +

+ <%if(isNotEmpty(doc.author)){%> +

Author: ${doc.author}

+ <%}%> +

Content-Type: ${doc.contentType} +

+

Description: ${htmlEscape(doc.detail)}

+ <%if(isNotEmpty(doc.requestHeaders)&&displayRequestParams){%> +

Request-headers:

+ + + + + + + + + + + + + + + + + + + <%for(header in doc.requestHeaders){%> + + + + + + + + + <%}%> + +
HeaderTypeDescriptionRequiredSinceExample

${header.name}

${header.type}

${htmlEscape(header.desc)}

${header.required}

${header.since}

${header.value}

+ <%}%><%if(isNotEmpty(doc.pathParams)&&displayRequestParams){%> +

Path-parameters:

+ + + + + + + + + + + + + + + + + + + <%for(param in doc.pathParams){%> + + + + + + + + + <%}%> + +
ParameterTypeDescriptionRequiredSinceExample

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

${param.value}

+ <%}%><%if(isNotEmpty(doc.queryParams)&&displayRequestParams){%> +

Query-parameters:

+ + + + + + + + + + + + + + + + + + + <%for(param in doc.queryParams){%> + + + + + + + + + <%}%> + +
ParameterTypeDescriptionRequiredSinceExample

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

${param.value}

+ <%}%><%if(isNotEmpty(doc.requestParams)&&displayRequestParams){%> +

Body-parameters:

+ + + + + + + + + + + + + + + + + + + <%for(param in doc.requestParams){%> + + + + + + + + + <%}%> + +
ParameterTypeDescriptionRequiredSinceExample

${param.field}

${param.type}

${param.desc}

${param.required}

${param.version}

${param.value}

+ <%}%><%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%> +

Request-example:

+
+
+
${doc.requestUsage}
+
+
+ <%}%><%if(isNotEmpty(doc.responseParams)&&displayResponseParams){%> +

Response-fields:

+ + + + + + + + + + + + + + + + + <%for(param in doc.responseParams){%> + + + + + + + + <%}%> + +
FieldTypeDescriptionSinceExample

${param.field}

${param.type}

${param.desc}

${param.version}

${param.value}

+ <%}%><%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%> +

Response-example:

+
+
+
${doc.responseUsage}
+
+
+ <%}%> +
+ <%}%> +
+
+ <%}%><%}%><%if(isNotEmpty(errorCodeList)){%> +

${errorCodeListOrder}.${errorListTitle} +

+
+ + + + + + + + + + + + <%for(error in errorCodeList){%> + + + + + <%}%> + +
Error codeDescription

${error.value}

${htmlEscape(error.desc)}

+
+
+ <%}%><%if(isNotEmpty(dictList)){%> +

${dictListOrder}.${dictListTitle} +

+
<%for(dict in dictList){%> +

${dictListOrder}.${dict.order}.${htmlEscape(dict.title)} +

+ + + + + + + + + + + + + + + + + <%for(dataDict in dict.dataDictList){%> + + + + + + + <%}%> + +
NameCodeTypeDescription

${dataDict.name}

${dataDict.value}

${dataDict.type}

${htmlEscape(dataDict.desc)}

+
+ <%}%> +
+
+ <%}%> + +
Top
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/template/ApiDoc.adoc b/src/main/resources/template/ApiDoc.adoc index c238581e8..22f47639f 100644 --- a/src/main/resources/template/ApiDoc.adoc +++ b/src/main/resources/template/ApiDoc.adoc @@ -20,14 +20,18 @@ for(doc in list){ *Description:* ${doc.detail} -<%if(isNotEmpty(doc.headers)){%> +<%if(isNotEmpty(doc.requestHeaders)){%> *Request-headers:* [width="100%",options="header"] [stripes=even] |==================== -|Header | Type|Required|Description|Since -${doc.headers} +|Header | Type|Required|Description|Since|Example +<% +for(param in doc.requestHeaders){ +%> +|${param.name}|${param.type}|${param.required}|${param.desc}|${param.since}|${param.value} +<%}%> |==================== <%}%> @@ -38,11 +42,11 @@ ${doc.headers} [width="100%",options="header"] [stripes=even] |==================== -|Parameter | Type|Required|Description|Since +|Parameter | Type|Required|Description|Since|Example <% for(param in doc.pathParams){ %> -|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> @@ -53,11 +57,11 @@ for(param in doc.pathParams){ [width="100%",options="header"] [stripes=even] |==================== -|Parameter | Type|Required|Description|Since +|Parameter | Type|Required|Description|Since|Example <% for(param in doc.queryParams){ %> -|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> @@ -68,11 +72,11 @@ for(param in doc.queryParams){ [width="100%",options="header"] [stripes=even] |==================== -|Parameter | Type|Required|Description|Since +|Parameter | Type|Required|Description|Since|Example <% for(param in doc.requestParams){ %> -|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.required}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> @@ -90,11 +94,11 @@ ${doc.requestUsage} [width="100%",options="header"] [stripes=even] |==================== -|Field | Type|Description|Since +|Field | Type|Description|Since|Example <% for(param in doc.responseParams){ %> -|${param.field}|${param.type}|${param.desc}|${param.version} +|${param.field}|${param.type}|${param.desc}|${param.version}|${param.value} <%}%> |==================== <%}%> diff --git a/src/main/resources/template/html/index.html b/src/main/resources/template/html/index.html index c9ee3e346..10e50a7f0 100644 --- a/src/main/resources/template/html/index.html +++ b/src/main/resources/template/html/index.html @@ -93,6 +93,7 @@ Description Required Since + Example <%for(header in doc.requestHeaders){%> @@ -102,6 +103,7 @@

${htmlEscape(header.desc)}

${header.required}

${header.since}

+

${header.value}

<%}%> @@ -123,6 +125,7 @@ Description Required Since + Example <%for(param in doc.pathParams){%> @@ -132,6 +135,7 @@

${htmlEscape(param.desc)}

${param.required}

${param.version}

+

${param.value}

<%}%> @@ -153,6 +157,7 @@ Description Required Since + Example <%for(param in doc.queryParams){%> @@ -162,6 +167,7 @@

${htmlEscape(param.desc)}

${param.required}

${param.version}

+

${param.value}

<%}%> @@ -183,6 +189,7 @@ Description Required Since + Example <%for(param in doc.requestParams){%> @@ -192,6 +199,7 @@

${htmlEscape(param.desc)}

${param.required}

${param.version}

+

${param.value}

<%}%> @@ -218,6 +226,7 @@ Type Description Since + Example <%for(param in doc.responseParams){%> @@ -226,6 +235,7 @@

${param.type}

${htmlEscape(param.desc)}

${param.version}

+

${param.value}

<%}%> diff --git a/src/main/resources/template/word/AllInOneWordTemplate.xml b/src/main/resources/template/word/AllInOneWordTemplate.xml index bcff7b8d0..af93299c2 100644 --- a/src/main/resources/template/word/AllInOneWordTemplate.xml +++ b/src/main/resources/template/word/AllInOneWordTemplate.xml @@ -502,7 +502,7 @@ - <%if(isNotEmpty(doc.headers)){%> + <%if(isNotEmpty(doc.requestHeaders)){%> @@ -664,6 +664,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(header in doc.requestHeaders){ @@ -784,6 +809,29 @@ + + + + + + + + + + <%if (headerLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${header.value} + + + <%}%> @@ -952,6 +1000,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.pathParams){ @@ -1072,6 +1145,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%> @@ -1240,6 +1336,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.queryParams){ @@ -1360,6 +1481,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%> @@ -1529,6 +1673,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.requestParams){ @@ -1649,6 +1818,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%> @@ -1826,6 +2018,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.responseParams){ @@ -1920,6 +2137,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%> diff --git a/src/main/resources/template/word/index.xml b/src/main/resources/template/word/index.xml index ac5fd23cd..1213ae4cf 100644 --- a/src/main/resources/template/word/index.xml +++ b/src/main/resources/template/word/index.xml @@ -173,7 +173,7 @@ - <%if(isNotEmpty(doc.headers)){%> + <%if(isNotEmpty(doc.requestHeaders)){%> @@ -335,6 +335,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(header in doc.requestHeaders){ @@ -455,6 +480,29 @@ + + + + + + + + + + <%if (headerLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${header.value} + + + <%}%> @@ -623,6 +671,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.pathParams){ @@ -743,6 +816,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%> @@ -911,6 +1007,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.queryParams){ @@ -1031,6 +1152,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%> @@ -1200,6 +1344,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.requestParams){ @@ -1320,6 +1489,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%> @@ -1497,6 +1689,31 @@ + + + + + + + + + + + + + + + + + + + + + + Example + + + <% for(param in doc.responseParams){ @@ -1591,6 +1808,29 @@ + + + + + + + + + + <%if (paramLP.index % 2 == 0) {%> + + <%}%> + + + + + + + + ${param.value} + + + <%}%>