Skip to content

[0.10] Apply streaming trait directly to shapes#340

Merged
JordonPhillips merged 1 commit intosmithy-lang:0.10from
JordonPhillips:no-stream-on-member
Apr 2, 2020
Merged

[0.10] Apply streaming trait directly to shapes#340
JordonPhillips merged 1 commit intosmithy-lang:0.10from
JordonPhillips:no-stream-on-member

Conversation

@JordonPhillips
Copy link
Copy Markdown
Contributor

This updates the streaming trait to apply directly to shapes instead of
members. This was previously restricted to members because it made the
model easier to validate and grok at a glance. However, keeping it on
members introduces potential errors in code generation. A given blob
could have both the streaming trait and the media type trait, for
instance. Both of these traits could result in a new type being created,
but since the streaming trait is applied to a member that type is
implicit. The code generator would have to try to generate a name that
doesn't conflict with any existing names, which is very error prone and
likely would result in unfortunate names. Moving this trait to the
shape directly makes the naming concern an explicit part of modeling,
where it will only have to be handled once.

This also brings the trait in line with the general best practice of
having traits that impact the type generated apply directly to the
shapes they impact.

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

@JordonPhillips JordonPhillips changed the title Apply streaming trait directly to shapes [0.10] Apply streaming trait directly to shapes Mar 31, 2020
This updates the streaming trait to apply directly to shapes instead of
members. This was previously restricted to members because it made the
model easier to validate and grok at a glance. However, keeping it on
members introduces potential errors in code generation. A given blob
could have both the streaming trait and the media type trait, for
instance. Both of these traits could result in a new type being created,
but since the streaming trait is applied to a member that type is
implicit. The code generator would have to try to generate a name that
doesn't conflict with any existing names, which is very error prone and
likely would result in unfortunate names. Moving this trait to the
shape directly makes the naming concern an explicit part of modeling,
where it will only have to be handled once.

This also brings the trait in line with the general best practice of
having traits that impact the type generated apply directly to the
shapes they impact.
@JordonPhillips JordonPhillips merged commit 76fff9e into smithy-lang:0.10 Apr 2, 2020
@kstich kstich mentioned this pull request Apr 23, 2020
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.

2 participants