Skip to content

Commit 7fb0192

Browse files
author
springdoc
committed
Preserve order of parameters in @parameters annotation. Fixes #274
1 parent 5ae2721 commit 7fb0192

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ private Map<String, io.swagger.v3.oas.annotations.Parameter> getApiParameters(Me
342342

343343
Set<io.swagger.v3.oas.annotations.Parameters> apiParametersDoc = AnnotatedElementUtils
344344
.findAllMergedAnnotations(method, io.swagger.v3.oas.annotations.Parameters.class);
345-
Map<String, io.swagger.v3.oas.annotations.Parameter> apiParametersMap = apiParametersDoc.stream()
346-
.flatMap(x -> Stream.of(x.value())).collect(Collectors.toMap(io.swagger.v3.oas.annotations.Parameter::name, x -> x));
345+
LinkedHashMap<String, io.swagger.v3.oas.annotations.Parameter> apiParametersMap = apiParametersDoc.stream()
346+
.flatMap(x -> Stream.of(x.value())).collect(Collectors.toMap(io.swagger.v3.oas.annotations.Parameter::name, x -> x, (e1, e2) -> e2,
347+
LinkedHashMap::new));
347348

348349
Set<io.swagger.v3.oas.annotations.Parameters> apiParametersDocDeclaringClass = AnnotatedElementUtils
349350
.findAllMergedAnnotations(declaringClass, io.swagger.v3.oas.annotations.Parameters.class);

0 commit comments

Comments
 (0)