Merge branch 'master' into master

This commit is contained in:
shalousun 2020-07-13 14:07:53 +08:00 committed by GitHub
commit d2a64b7829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 682 additions and 652 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

@ -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;

View File

@ -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;
}
}

View File

@ -9,6 +9,8 @@
"md5EncryptedHtmlName": false,
"projectName": "smart-doc",
"skipTransientField": true,
"requestExample": true,
"responseExample": true,
"revisionLogs": [
{
"version": "1.0",

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}

View File

@ -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

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>