Skip to content

Use ordered sets for shape id sequences#2742

Merged
JordonPhillips merged 2 commits into
smithy-lang:mainfrom
JordonPhillips:dont-sort-id-lists
Aug 15, 2025
Merged

Use ordered sets for shape id sequences#2742
JordonPhillips merged 2 commits into
smithy-lang:mainfrom
JordonPhillips:dont-sort-id-lists

Conversation

@JordonPhillips
Copy link
Copy Markdown
Contributor

@JordonPhillips JordonPhillips commented Aug 14, 2025

Several shapes have properties that are sequences of shape ids, such as an OperationShape's errors. Previously these shapes were using the List structure to store these in Java, but since the order of these sequences isn't actually semantically important, it was causing equality checks to fail where the should not.

This replaces those usages of List to LinkedHashSet. That way the order in the model may still be preserved, but the equality is set equality. Additionally, duplicates in these sequences have no meaning, so the deduplication of sets is a benefit in that sense too.

Fixes #2735

Note that we already use ordered sets for the lists of operations and resources on service and resource shapes


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

Several shapes have properties that are sequences of shape ids, such
as an OperationShape's errors. Previously these shapes were using the
List structure to store these in Java, but since the order of these
sequences isn't actually semantically important, it was causing
equality checks to fail where the should not.

This replaces those usages of `List` to `LinkedHashSet`. That way the
order in the model may still be preserved, but the equality is set
equality. Additionally, duplicates in these sequences have no
meaning, so the deduplication of sets is a benefit in that sense too.
@JordonPhillips JordonPhillips requested a review from a team as a code owner August 14, 2025 11:16
@JordonPhillips JordonPhillips requested review from joewyz and yefrig and removed request for joewyz August 14, 2025 11:16
Co-authored-by: Yefri Gaitan <34199474+yefrig@users.noreply.github.com>
@JordonPhillips JordonPhillips merged commit 178fef6 into smithy-lang:main Aug 15, 2025
8 checks passed
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.

Unintuitive behavior of ModelSerializer

2 participants