Put the KVPs of identifiers and properties fields of resource shapes on their own lines #2377
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.
Background
What do these changes do?
Updates the formatting logic to put the key-value pairs of the
identifiers
andproperties
fields ofresource
shapes on individual lines instead of combining them onto a single lineWhy are they important?
While the existing formatting works for simple single-identifier resources, resources with multiple identifiers quickly become unwieldy due to their identifiers being forced onto a single line.
For identifiers this is only an annoyance because most resources only have 1 or 2 identifiers. For properties, this can easily get out of hand because resources will generally have many resources.
For example, this is the current formatted version of a resource within a service I'm currently developing:
My argument here is that the following format is more easy to parse as a reviewer:
Alternatives
An alternative I'm willing to look into implementing is updating the logic that currently forces all of the items of key-value pairs inside of objects into being smarter about when to place the items on a single line. A reasonable behavior in my opinion would be for it to keep values to a single line if there's only a single item, switching to the multi-line behavior when there's more than a single item.
Testing
Links
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.