Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Can not configure globalOperationParameters #222 #223 #224

Merged
merged 1 commit into from
Dec 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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