Skip to content

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

Merged
kstich merged 3 commits intosmithy-lang:mainfrom
alextwoods:authSchemesOrder
Jan 25, 2023
Merged

Ensure that AuthSchemes added to Endpoint builder retain parameter ordering#1591
kstich merged 3 commits intosmithy-lang:mainfrom
alextwoods:authSchemesOrder

Conversation

@alextwoods
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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