Merge branch 'master' into master
This commit is contained in:
commit
d2a64b7829
|
@ -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 {
|
||||
|
|
|
@ -46,9 +46,9 @@ public enum TemplateVariable {
|
|||
PROTOCOL("protocol"),
|
||||
AUTHOR("author"),
|
||||
URI("uri"),
|
||||
RPC_CONSUMER_CONFIG("consumerConfigExample")
|
||||
;
|
||||
|
||||
RPC_CONSUMER_CONFIG("consumerConfigExample"),
|
||||
REQUEST_EXAMPLE("isRequestExample"),
|
||||
RESPONSE_EXAMPLE("isResponseExample");
|
||||
|
||||
private String variable;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ApiConfig {
|
|||
/**
|
||||
* Set comments check mode
|
||||
*/
|
||||
private boolean isStrict;
|
||||
private Boolean isStrict = Boolean.FALSE;
|
||||
|
||||
/**
|
||||
* Merge all api doc into one document
|
||||
|
@ -205,6 +205,18 @@ public class ApiConfig {
|
|||
private int recursionLimit = 7;
|
||||
|
||||
/**
|
||||
* request example
|
||||
* @since 1.9.0
|
||||
*/
|
||||
private boolean requestExample = Boolean.TRUE;
|
||||
|
||||
/**
|
||||
* response example
|
||||
* @since 1.9.0
|
||||
*/
|
||||
private boolean responseExample = Boolean.TRUE;
|
||||
|
||||
/**
|
||||
* name of index
|
||||
*/
|
||||
private String indexFileName;
|
||||
|
@ -226,11 +238,11 @@ public class ApiConfig {
|
|||
this.serverUrl = serverUrl;
|
||||
}
|
||||
|
||||
public boolean isStrict() {
|
||||
public Boolean getStrict() {
|
||||
return isStrict;
|
||||
}
|
||||
|
||||
public void setStrict(boolean strict) {
|
||||
public void setStrict(Boolean strict) {
|
||||
isStrict = strict;
|
||||
}
|
||||
|
||||
|
@ -460,5 +472,19 @@ public class ApiConfig {
|
|||
this.recursionLimit = recursionLimit;
|
||||
}
|
||||
|
||||
public boolean isRequestExample() {
|
||||
return requestExample;
|
||||
}
|
||||
|
||||
public void setRequestExample(boolean requestExample) {
|
||||
this.requestExample = requestExample;
|
||||
}
|
||||
|
||||
public boolean isResponseExample() {
|
||||
return responseExample;
|
||||
}
|
||||
|
||||
public void setResponseExample(boolean responseExample) {
|
||||
this.responseExample = responseExample;
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@
|
|||
"md5EncryptedHtmlName": false,
|
||||
"projectName": "smart-doc",
|
||||
"skipTransientField": true,
|
||||
"requestExample": true,
|
||||
"responseExample": true,
|
||||
"revisionLogs": [
|
||||
{
|
||||
"version": "1.0",
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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:**
|
||||
```
|
||||
${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:**
|
||||
```
|
||||
${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:*
|
||||
----
|
||||
${doc.requestUsage}
|
||||
|
@ -67,7 +67,7 @@ for(param in doc.responseParams){
|
|||
<%}%>
|
||||
|====================
|
||||
|
||||
<%if(isNotEmpty(doc.responseUsage)){%>
|
||||
<%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>
|
||||
*Response-example:*
|
||||
----
|
||||
${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:**
|
||||
```
|
||||
${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}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue