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

Maintain order of operations and resources #602

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

mtdowling
Copy link
Member

This commit updates service and operation shapes to maintain the order
in which operations and resources are defined in a Smithy model. Note
that resource lifecycle operation order is not maintained since those
are named operations that don't have any particular order in a model
like a list of operations, collectionOperations, or resources do.

To achieve this, I added a couple new helper methods to make copies of
Maps and Sets that maintains order.

Closes #591

This commit updates service and operation shapes to maintain the order
in which operations and resources are defined in a Smithy model. Note
that resource lifecycle operation order is not maintained since those
are named operations that don't have any particular order in a model
like a list of operations, collectionOperations, or resources do.

To achieve this, I added a couple new helper methods to make copies of
Maps and Sets that maintains order.

Closes #591
@Baccata
Copy link

Baccata commented Oct 15, 2020

👍

Copy link
Contributor

@kstich kstich left a comment

Choose a reason for hiding this comment

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

Should there be associated spec updates with this, like with the recommendation to add members to the ends of their respective shapes?

@mtdowling
Copy link
Member Author

I don't see this as something for the spec right now for a few reasons:

  1. I think there's an implicit expectation about ordering here because these operations and resources are defined in lists which are inherently ordered.
  2. Adding operations or resources in a recommended order isn't the intention here; this just guarantees maintaining order in the in-memory semantic model, and order is completely arbitrary and up to the modeler.
  3. I think this is more of an "implementer's note" which could be added later if we discover it's necessary to explicitly mandate this detail of the semantic model.

@mtdowling mtdowling merged commit 505a6c8 into master Oct 19, 2020
@mtdowling mtdowling deleted the maintain-operation-resource-order branch December 11, 2020 17:59
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.

EntityShape#operations should be ordered
3 participants