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

Refactor event streams to target members #171

Merged
merged 1 commit into from
Sep 24, 2019
Merged

Conversation

mtdowling
Copy link
Member

This commit removes the inputEventStream and outputEventStream traits
and replaces them with the eventStream trait that targets members. This
simplifies the model, validation, code generation, and I found that it
makes it easier to model operations correctly. In fact, several typos
were fixed in the documentation while making these changes due to the
fact that the previous design required that the member name of an
input/output shape is referenced from the operation.

The major drawbacks of this approach are:

  1. It's a breaking change. While this is a breaking change, no models are
    currently using the event stream feature in Smithy, and external tooling
    hasn't been published that consumes them either.

  2. Structures that contain an event stream cannot be targeted by anything
    other than operation input or output. While it's awkward that event stream
    structures are essentially "poisoned" and can't be targeted by other
    members or used as errors, it does make event stream far easier to use
    with code generation since the structure itself does not need to be
    specialized when generating operation inputs and outputs. If we find
    ourselves needing to use this for other abstractions, something more
    reusable like a trait attribute could be introduced to automate this
    validation.

Issue #, if available:

Description of changes:

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

@mtdowling mtdowling requested a review from kstich September 22, 2019 15:05
This commit removes the inputEventStream and outputEventStream traits
and replaces them with the eventStream trait that targets members. This
simplifies the model, validation, code generation, and I found that it
makes it easier to model operations correctly. In fact, several typos
were fixed in the documentation while making these changes due to the
fact that the previous design required that the member name of an
input/output shape is referenced from the operation.

The major drawbacks of this approach are:

1) It's a breaking change. While this is a breaking change, no models are
currently using the event stream feature in Smithy, and external tooling
hasn't been published that consumes them either.

2) Structures that contain an event stream cannot be targeted by anything
other than operation input or output. While it's awkward that event stream
structures are essentially "poisoned" and can't be targeted by other
members or used as errors, it does make event stream far easier to use
with code generation since the structure itself does not need to be
specialized when generating operation inputs and outputs. If we find
ourselves needing to use this for other abstractions, something more
reusable like a trait attribute could be introduced to automate this
validation.
@mtdowling mtdowling force-pushed the refactor-event-streams branch from d541696 to a47242a Compare September 24, 2019 02:34
@mtdowling mtdowling requested a review from kstich September 24, 2019 02:35
@mtdowling mtdowling merged commit ae4ca83 into master Sep 24, 2019
@mtdowling mtdowling deleted the refactor-event-streams branch October 15, 2019 20:11
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