fix:gitee #I3W9DY

This commit is contained in:
songhaozhi 2021-06-26 15:38:07 +08:00
parent 021c5253cd
commit 84c9af7a1f
2 changed files with 12 additions and 12 deletions

View File

@ -67,16 +67,16 @@ public class ApiReqHeader {
private String since = "-";
/**
* ignore request header
* Regular expression ignore request header
*/
private String regex;
private String urlPatterns;
public String getRegex() {
return regex;
public String getUrlPatterns() {
return urlPatterns;
}
public void setRegex(String regex) {
this.regex = regex;
public void setUrlPatterns(String urlPatterns) {
this.urlPatterns = urlPatterns;
}
@Deprecated
@ -170,8 +170,8 @@ public class ApiReqHeader {
.append(required);
sb.append(",\"since\":\"")
.append(since).append('\"');
sb.append(",\"regex\":\"")
.append(regex).append('\"');
sb.append(",\"urlPatterns\":\"")
.append(urlPatterns).append('\"');
sb.append('}');
return sb.toString();
}

View File

@ -225,14 +225,14 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
} else {
allApiReqHeaders = apiReqHeaders;
}
//reduce create in template
apiMethodDoc.setHeaders(this.createDocRenderHeaders(allApiReqHeaders, apiConfig.isAdoc()));
allApiReqHeaders.removeIf(apiReqHeader -> {
if (StringUtil.isNotEmpty(apiReqHeader.getRegex())) {
return requestMapping.getShortUrl().matches(apiReqHeader.getRegex());
if (StringUtil.isNotEmpty(apiReqHeader.getUrlPatterns())) {
return requestMapping.getShortUrl().matches(apiReqHeader.getUrlPatterns());
}
return false;
});
//reduce create in template
apiMethodDoc.setHeaders(this.createDocRenderHeaders(allApiReqHeaders, apiConfig.isAdoc()));
apiMethodDoc.setRequestHeaders(allApiReqHeaders);
// build request json