Skip to content

Commit af47269

Browse files
authored
Merge pull request springdoc#1742 from zhangtongjob/master
Optimize the group order problem
2 parents 5580464 + 52b376f commit af47269

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/SwaggerUiConfigParameters.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public SwaggerUiConfigParameters(SwaggerUiConfigProperties swaggerUiConfig) {
171171
this.showExtensions = swaggerUiConfig.getShowExtensions();
172172
this.supportedSubmitMethods = swaggerUiConfig.getSupportedSubmitMethods();
173173
this.url = swaggerUiConfig.getUrl();
174-
this.urls = swaggerUiConfig.getUrls() == null ? new HashSet<>() : swaggerUiConfig.cloneUrls();
174+
this.urls = swaggerUiConfig.getUrls() == null ? new LinkedHashSet<>() : swaggerUiConfig.cloneUrls();
175175
this.urlsPrimaryName = swaggerUiConfig.getUrlsPrimaryName();
176176
this.groupsOrder = swaggerUiConfig.getGroupsOrder();
177177
this.tryItOutEnabled = swaggerUiConfig.getTryItOutEnabled();
@@ -317,4 +317,4 @@ private boolean isSwaggerUrlDefined(String name) {
317317
return swaggerUiConfig.getUrls().stream().anyMatch(swaggerUrl -> name.equals(swaggerUrl.getName()) && StringUtils.isNotBlank(swaggerUrl.getUrl()));
318318
return false;
319319
}
320-
}
320+
}

springdoc-openapi-common/src/main/java/org/springdoc/core/SwaggerUiConfigProperties.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222

2323
package org.springdoc.core;
2424

25-
import java.util.Set;
26-
import java.util.stream.Collectors;
27-
2825
import org.apache.commons.lang3.StringUtils;
29-
3026
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
3127
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3228
import org.springframework.boot.context.properties.ConfigurationProperties;
3329
import org.springframework.context.annotation.Configuration;
3430
import org.springframework.context.annotation.Lazy;
3531

32+
import java.util.LinkedHashSet;
33+
import java.util.Set;
34+
import java.util.stream.Collectors;
35+
3636
import static org.springdoc.core.Constants.SPRINGDOC_SWAGGER_UI_ENABLED;
3737

3838

@@ -431,7 +431,7 @@ public void setSyntaxHighlight(SyntaxHighlight syntaxHighlight) {
431431
* @return the set
432432
*/
433433
public Set<SwaggerUrl> cloneUrls(){
434-
return this.urls.stream().map(swaggerUrl -> new SwaggerUrl(swaggerUrl.getName(), swaggerUrl.getUrl(), swaggerUrl.getDisplayName())).collect(Collectors.toSet());
434+
return this.urls.stream().map(swaggerUrl -> new SwaggerUrl(swaggerUrl.getName(), swaggerUrl.getUrl(), swaggerUrl.getDisplayName())).collect(Collectors.toCollection(LinkedHashSet::new));
435435
}
436436

437-
}
437+
}

0 commit comments

Comments
 (0)