Skip to content

Commit 10bbaa8

Browse files
authored
Merge pull request #224 from llin6025/fix-issue-223
fix: Can not configure globalOperationParameters #222 #223
2 parents c266ccb + 459aa10 commit 10bbaa8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/com/spring4all/swagger/DocketConfiguration.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.springframework.boot.context.properties.EnableConfigurationProperties;
1717
import org.springframework.context.annotation.Bean;
1818
import org.springframework.context.annotation.Configuration;
19+
import org.springframework.util.CollectionUtils;
1920

2021
import com.google.common.base.Predicates;
2122

@@ -34,8 +35,7 @@
3435
* @author 程序猿DD
3536
* @author andi.lin
3637
*
37-
* Created on 2017/8/7
38-
* Update on 2021/8/13
38+
* Created on 2017/8/7 Update on 2021/8/13
3939
*/
4040
@Configuration
4141
@EnableConfigurationProperties(SwaggerProperties.class)
@@ -150,6 +150,10 @@ public void createSpringFoxRestApi() {
150150
* @return RequestParameter {@link RequestParameter}
151151
*/
152152
private List<RequestParameter> getRequestParameters(List<SwaggerProperties.GlobalOperationParameter> properties) {
153+
if (CollectionUtils.isEmpty(properties)) {
154+
return new ArrayList<>();
155+
}
156+
153157
return properties.stream()
154158
.map(param -> new RequestParameterBuilder().name(param.getName()).description(param.getDescription())
155159
.in(ParameterType.from(param.getParameterType())).required(param.getRequired())
@@ -163,8 +167,10 @@ private List<RequestParameter> getRequestParameters(List<SwaggerProperties.Globa
163167
/**
164168
* 局部参数按照name覆盖局部参数
165169
*
166-
* @param globalRequestParameters 全局配置
167-
* @param groupRequestParameters Group 的配置
170+
* @param globalRequestParameters
171+
* 全局配置
172+
* @param groupRequestParameters
173+
* Group 的配置
168174
* @return 汇总配置
169175
*/
170176
private List<RequestParameter> assemblyRequestParameters(

0 commit comments

Comments
 (0)