update
This commit is contained in:
@@ -58,28 +58,12 @@ public class Swagger2Config {
|
||||
.globalOperationParameters(pars);
|
||||
}
|
||||
|
||||
private Docket createDocketByPath (String groupName, String... paths){
|
||||
List<Parameter> pars = getParameters();
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(Boolean.TRUE)
|
||||
.apiInfo(this.getApiInfo())
|
||||
.groupName(groupName)
|
||||
.select()
|
||||
.paths(this.scanPath(paths))
|
||||
.build()
|
||||
.globalOperationParameters(pars);
|
||||
}
|
||||
|
||||
private List<Parameter> getParameters() {
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
pars.add(new ParameterBuilder().name("accessToken").description("令牌").required(true)
|
||||
.modelRef(new ModelRef("string"))
|
||||
.defaultValue("{{accessToken}}")
|
||||
.parameterType("query").build());
|
||||
pars.add(new ParameterBuilder().name("enterpriseId").required(true)
|
||||
.modelRef(new ModelRef("string"))
|
||||
.defaultValue("45f92210375346858b6b6694967f44de")
|
||||
.parameterType("path").build());
|
||||
return pars;
|
||||
}
|
||||
|
||||
@@ -94,17 +78,6 @@ public class Swagger2Config {
|
||||
return predicate;
|
||||
}
|
||||
|
||||
private Predicate<String> scanPath(final String... paths) {
|
||||
Predicate<String> predicate = null;
|
||||
for (String path : paths) {
|
||||
if(StringUtils.isNotBlank(path)){
|
||||
Predicate<String> tempPredicate = PathSelectors.ant(path);
|
||||
predicate = predicate == null ? tempPredicate : Predicates.or(tempPredicate,predicate);
|
||||
}
|
||||
}
|
||||
return predicate;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Docket allApi() {
|
||||
|
||||
Reference in New Issue
Block a user