commit
0bcd1ea31e
|
@ -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 {
|
||||||
|
|
|
@ -46,9 +46,9 @@ public enum TemplateVariable {
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,14 @@ public class ApiConfig {
|
||||||
*/
|
*/
|
||||||
private int recursionLimit = 7;
|
private int recursionLimit = 7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* request example
|
||||||
|
*/
|
||||||
|
private boolean isRequestExample;
|
||||||
|
/**
|
||||||
|
* response example
|
||||||
|
*/
|
||||||
|
private boolean isResponseExample;
|
||||||
public String getServerUrl() {
|
public String getServerUrl() {
|
||||||
return serverUrl;
|
return serverUrl;
|
||||||
}
|
}
|
||||||
|
@ -447,5 +454,19 @@ public class ApiConfig {
|
||||||
this.recursionLimit = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -57,7 +57,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}
|
||||||
|
@ -75,7 +75,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}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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}
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue