Smithy IDL 2.1 Makes API Models More Local, but Keeps the Same Underlying Shapes
Smithy 2.1 adds inline collections, tagged literals, and member-index shorthand. See what changes for API authors and why compatibility still matters.
On this page

An API model often becomes harder to scan when its useful meaning is split across helper declarations. In Smithy 2.0, a structure member that held a list usually pointed to a separately named list shape. Smithy IDL 2.1 lets the model declare some lists and maps inline, closer to the member that uses them. AWS announced the syntax on November 16, alongside tagged string literals and shorthand for member indexes. [1]
Smithy is an interface definition language and toolchain: teams define services in a model, then generate clients, servers, and documentation across languages. That makes model readability consequential for both API owners and downstream code generators. The new version’s promise is narrower than “simpler APIs”: it reduces syntax overhead in specific model patterns without changing the contract consumers receive. [1]
Inline collections reduce indirection
Imagine a Playlist structure with a list of songs and a map of tags. In 2.0, the list needs a named shape such as SongList; the map may need another declaration. In 2.1, the member can state [Song] or {String: String} directly. The member tells the reader both its name and collection type in one place. [1]
The new syntax is not a new kind of shape. Smithy’s assembler turns each distinct inline collection into an ordinary list or map marked with the synthetic trait. Code generators and model consumers continue to see standard model shapes. Two compatible inline collections in the same namespace can share the same generated shape. AWS cautions that the generated _Synthetic names are reserved implementation details and may change; consumers should not depend on those names. [1] [2]
Inline collections can nest up to three levels, but they do not support every trait. In particular, the announcement says @sparse and @uniqueItems require a named shape. Traits placed on a member can also constrain only that member’s collection, while a trait on a shared named shape can affect every member that targets it. [1]
That leaves a useful modeling rule: inline a collection when it is local and self-explanatory; keep a named shape when it has domain meaning, is reused, or needs traits the inline form cannot express. Less syntax is not always a better model if it erases a concept API consumers need to understand.
Tagged strings stop double-escaping
Smithy patterns may contain backslashes. In a regular quoted string, a backslash can need escaping for the string syntax and again for the regular expression. Tagged literals introduce a prefix that tells the parser how to interpret the contents. The #re tag treats the pattern text literally, so a digit matcher such as \d does not need to be doubled for the Smithy string parser. Multiline tagged text can make long expressions easier to inspect. [1]
The 2.1 announcement lists four tags: #re for regular expressions, #b for binary content, #hex for hexadecimal bytes, and #timestamp for RFC 3339 timestamps. Binary and hex forms resolve to base64 strings; timestamps resolve to epoch seconds. Tags exist in IDL source but do not persist as tags in the JSON AST; when a model is serialized back to IDL, the decoded value is written instead. [1]
These details matter if a build pipeline round-trips models between text and AST: the semantic value can survive while the author’s preferred tagged notation does not. Treat tagged forms as ergonomic source syntax, not metadata that downstream tooling can rely on retaining.
Member indexes make wire order explicit
Some protocols encode structure members by position. IDL 2.0 can attach an idx trait to every member; 2.1 allows an ordinal shorthand such as 1. id, 2. title, and 3. durationSeconds. A service-level indexed trait declares that the structures and unions in its model closure must use indexes. [1]
This is a concise way to declare a protocol requirement, but the numbers are compatibility surface. If a member index is embedded in a binary payload, changing it can break readers even if a JSON representation looks unchanged. Keep indexes stable, review them like field numbers in a serialization protocol, and verify that generated clients preserve the intended behavior.
What should teams do now?
Before adopting the syntax, confirm the Smithy version supported by your build plugins and code generators. Check model assembly output rather than relying on synthetic names. Run generated-client compatibility checks, and review any protocol indexes as wire-level changes. For inline forms, decide whether the collection is truly member-local or whether its name and reuse communicate important domain meaning.
Smithy 2.1’s practical benefit is local clarity: fewer declarations to jump between and less escaping noise. It does not remove the need to design versioned API contracts carefully. Readability is part of reliability when it helps reviewers see what a model says, but stable model semantics still determine whether generated clients remain compatible. [1]
/* Comments */
Comments are offline right now — we reconnect automatically, nothing is lost.