fix:gitee I3W9DY

This commit is contained in:
songhaozhi 2021-06-26 11:54:06 +08:00
parent 5a147bac10
commit 7064028106
2 changed files with 21 additions and 0 deletions

View File

@ -66,6 +66,19 @@ public class ApiReqHeader {
*/
private String since = "-";
/**
* ignore request header
*/
private String regex;
public String getRegex() {
return regex;
}
public void setRegex(String regex) {
this.regex = regex;
}
@Deprecated
public static ApiReqHeader header() {
return new ApiReqHeader();
@ -157,6 +170,8 @@ public class ApiReqHeader {
.append(required);
sb.append(",\"since\":\"")
.append(since).append('\"');
sb.append(",\"regex\":\"")
.append(regex).append('\"');
sb.append('}');
return sb.toString();
}

View File

@ -227,6 +227,12 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
}
//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());
}
return false;
});
apiMethodDoc.setRequestHeaders(allApiReqHeaders);
// build request json