Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 968f420

Browse files
committed
fix getPathParameter determinism
getPathParameter was using a HashSet, when a LinkedHashSet preserves the path ordering of the returned parameters.
1 parent 8794cce commit 968f420

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

endpoints-framework/src/main/java/com/google/api/server/spi/config/model/ApiMethodConfig.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@
2626
import com.google.common.base.Preconditions;
2727
import com.google.common.collect.ImmutableList;
2828
import com.google.common.reflect.TypeToken;
29-
3029
import java.lang.reflect.Method;
3130
import java.lang.reflect.Type;
3231
import java.util.ArrayList;
3332
import java.util.Collection;
34-
import java.util.HashSet;
33+
import java.util.LinkedHashSet;
3534
import java.util.List;
3635
import java.util.Map;
3736
import java.util.Objects;
@@ -499,7 +498,7 @@ public Collection<String> getPathParameters() {
499498
Pattern pathPattern = java.util.regex.Pattern.compile("\\{([^\\}]*)\\}");
500499
Matcher pathMatcher = pathPattern.matcher(path);
501500

502-
Collection<String> pathParameters = new HashSet<>();
501+
Collection<String> pathParameters = new LinkedHashSet<>();
503502
while (pathMatcher.find()) {
504503
pathParameters.add(pathMatcher.group(1));
505504
}

0 commit comments

Comments
 (0)