Skip to content

Commit

Permalink
fix: Can not configure globalOperationParameters SpringForAll#222 Spr…
Browse files Browse the repository at this point in the history
  • Loading branch information
llin6025 committed Nov 18, 2021
1 parent c266ccb commit 459aa10
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/com/spring4all/swagger/DocketConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.CollectionUtils;

import com.google.common.base.Predicates;

Expand All @@ -34,8 +35,7 @@
* @author 程序猿DD
* @author andi.lin
*
* Created on 2017/8/7
* Update on 2021/8/13
* Created on 2017/8/7 Update on 2021/8/13
*/
@Configuration
@EnableConfigurationProperties(SwaggerProperties.class)
Expand Down Expand Up @@ -150,6 +150,10 @@ public void createSpringFoxRestApi() {
* @return RequestParameter {@link RequestParameter}
*/
private List<RequestParameter> getRequestParameters(List<SwaggerProperties.GlobalOperationParameter> properties) {
if (CollectionUtils.isEmpty(properties)) {
return new ArrayList<>();
}

return properties.stream()
.map(param -> new RequestParameterBuilder().name(param.getName()).description(param.getDescription())
.in(ParameterType.from(param.getParameterType())).required(param.getRequired())
Expand All @@ -163,8 +167,10 @@ private List<RequestParameter> getRequestParameters(List<SwaggerProperties.Globa
/**
* 局部参数按照name覆盖局部参数
*
* @param globalRequestParameters 全局配置
* @param groupRequestParameters Group 的配置
* @param globalRequestParameters
* 全局配置
* @param groupRequestParameters
* Group 的配置
* @return 汇总配置
*/
private List<RequestParameter> assemblyRequestParameters(
Expand Down

0 comments on commit 459aa10

Please sign in to comment.