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

Ensure that AuthSchemes added to Endpoint builder retain parameter ordering #1591

Merged
merged 3 commits into from
Jan 25, 2023

Conversation

alextwoods
Copy link
Contributor

Description of changes:
Ensure that AuthSchemes added to Endpoint builder retain parameter ordering.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@alextwoods alextwoods requested a review from a team as a code owner January 24, 2023 23:58
this.authSchemes.get().add(Pair.of(Identifier.of(scheme),
parameters.entrySet().stream()
.collect(Collectors.toMap(k -> Identifier.of(k.getKey()), Map.Entry::getValue))));
Map<Identifier, Literal> transformedParameters = new LinkedHashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be sorting here? this relies on the incoming map being linked right? Or at least log a warning if the incoming map isn't linked?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it does rely on the incoming map being stable - and maybe the best approach here is to just sort all of these. My other thought was to provide AuthScheme builders that make building these property maps more fluid in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think an auth scheme builder is probably a good idea—I think we ended up writing one in some of the downstream crates

… always maintain a stable order and not rely on input to be stable
@kstich kstich merged commit a39e81b into smithy-lang:main Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants