-
Notifications
You must be signed in to change notification settings - Fork 218
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
Semantics of constrained event streams for the server #1388
Comments
Constrained shapes in the closure of an event stream are not supported [0]. However, the `ValidateUnsupportedConstraints` validator was not detecting constrained shapes in event stream errors because the `EventStreamNormalizer` model transformer pulls them out of the `@streaming` union shape. This commit makes it so that the validator will detect such usages, by leveraging the `SyntheticEventStreamUnionTrait` trait that gets attached in the model transformer. [0]: smithy-lang/smithy#1388
Constrained shapes in the closure of an event stream are not supported [0]. However, the `ValidateUnsupportedConstraints` validator was not detecting constrained shapes in event stream errors because the `EventStreamNormalizer` model transformer pulls them out of the `@streaming` union shape. This commit makes it so that the validator will detect such usages, by leveraging the `SyntheticEventStreamUnionTrait` trait that gets attached in the model transformer. [0]: smithy-lang/smithy#1388 Co-authored-by: Luca Palmieri <[email protected]>
My team just ran into this issue when trying to generate the Rust server SDK for a shared model. Interestingly, the Java and TypeScript code generators did not complain about the constraints applied to streamed events, but the Rust generator complained with a link to this issue. Is there a reason to treat constraint errors for an event fundamentally different from deserialization errors for events? Let's take for example:
It seems intuitive to treat a message JSON which fails the
in a similar way as
which also breaks the API contract because the type is At the moment the second kind of check happens implicitly during deserialization, while the first kind is made impossible. It is especially unfortunate that this also prevents |
These should be validated, and the server should close the event stream. Ideally it sends back a Validation error just like with other normal operations, and if you don't have a modeled error of this type, send back a generic protocol error. |
What should a server do upon receiving an event message in an event stream that does not satisfy the modeled constraint traits?
For example, with the following model, say a client sends an event message with
messageContent
set to a string of length 1.Should the server:
The text was updated successfully, but these errors were encountered: