This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Conversation
inklesspen
approved these changes
Feb 16, 2018
| private List<String> computeParameterOrder(ApiMethodConfig methodConfig) { | ||
| ImmutableSortedSet.Builder<String> queryParamBuilder = ImmutableSortedSet.naturalOrder(); | ||
| Collection<String> pathParameters = methodConfig.getPathParameters(); | ||
| List<String> order = new ArrayList<>(pathParameters); |
There was a problem hiding this comment.
Why not use an ImmutableList here too?
There was a problem hiding this comment.
Also, since order is not used in the loop, consider moving it below the loop.
Contributor
Author
There was a problem hiding this comment.
It's not used because we have to clone the whole discovery doc at times, and immutable structures are not cloneable. And done.
b485a03 to
220465e
Compare
To match the legacy parameterOrder, this change does the following: * optional query parameters are removed from parameterOrder * required query parameters are appended, sorted alphabetically, to the path parameters There is also a small optimization to call methodConfig.getPathParameters less frequently, as it is a relatively expensive call.
3f125c8 to
182d104
Compare
getPathParameter was using a HashSet, when a LinkedHashSet preserves the path ordering of the returned parameters.
Codecov Report
@@ Coverage Diff @@
## master #136 +/- ##
============================================
+ Coverage 79.84% 79.91% +0.06%
- Complexity 1661 1668 +7
============================================
Files 156 156
Lines 5568 5580 +12
Branches 716 719 +3
============================================
+ Hits 4446 4459 +13
Misses 843 843
+ Partials 279 278 -1
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.