diff --git a/src/main/java/com/power/doc/model/ApiReqHeader.java b/src/main/java/com/power/doc/model/ApiReqHeader.java index bc9402f..bc09153 100644 --- a/src/main/java/com/power/doc/model/ApiReqHeader.java +++ b/src/main/java/com/power/doc/model/ApiReqHeader.java @@ -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(); } diff --git a/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java b/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java index cb441cb..af354ef 100644 --- a/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java +++ b/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java @@ -227,6 +227,12 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate { } //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