Generate standalone types with Smithy
Developer Tools Blog
This article explains how Smithy's new shape closures feature enables generating standalone types for events published by services, eliminating the need for consumers to maintain separate event definitions.
- Shape closures allow defining named sets of shapes explicitly in a Smithy model for code generation
- Services can tag event structures and use selectors to include them in a closure without appearing in service operations
- Generated types include serialization and validation code, with support in smithy-java 1.5.1 and smithy-typescript 0.52.0
- Producers and subscribers share one generated definition, reducing errors from manual event definitions
- Example demonstrates publishing SightingReported and SightingWithdrawn events to Amazon SNS with CBOR encoding
- Subscribers deserialize events using the same generated types and codecs as producers
Shape closures enable consistent event modeling across services and consumers by generating types from a single source definition in the Smithy model.
The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.
The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.