Resource, structure and shape Three boxes. A resource attaches or mixes in structures and uses shapes at keys; a structure attaches structures and uses shapes; a shape stands alone.
uses a shape at a key
Resource
#[Resource(id, identity:,
storage:, access:)]
Identity: which one it is. With
none, a singleton.
Storage: load() , prepare() ,
commit() .
Operations: each a way in, gated
by its permission.
An access class may answer per
key.
Reached on its own, through its
operations.
Structure
#[Structure(id, access:)]
A group of keys, behind its own
wall.
Held by a parent, at a key with
variants, or by a plugin.
No identity, no storage, no
permission of its own.
An access class may answer for
its keys.
Reached only through what holds
it.
Shape
#[Shape(id)]
define(): one definition
One value: type, label,
constraints, examples.
Used at many keys: add($key,
MyShape::class) .
Each key may only narrow it; an
alter of it tightens every key.
Written once in each document,
as a def.
Declared once, used at many keys.
attaches,
mixes in
uses a
shape
attaches structures
stands alone: names nothing else
In Smithy's sense all three are shapes; #[Shape] names the third kind, one scalar value.
Resource, structure and shape A resource attaches or mixes in structures and uses shapes at keys; a structure attaches structures and uses shapes; a shape stands alone.
Resource
#[Resource(id, identity:,
storage:, access:)]
Identity: which one it is. With
none, a singleton.
Storage: load() , prepare() ,
commit() .
Operations: each a way in, gated
by its permission.
An access class may answer per
key.
Reached on its own, through its
operations.
attaches, mixes in
uses a shape at a key
Structure
#[Structure(id, access:)]
A group of keys, behind its own
wall.
Held by a parent, at a key with
variants, or by a plugin.
No identity, no storage, no
permission of its own.
An access class may answer for
its keys.
Reached only through what holds
it.
attaches structures
uses a shape
Shape
#[Shape(id)]
define(): one definition
One value: type, label,
constraints, examples.
Used at many keys: add($key,
MyShape::class) .
Each key may only narrow it; an
alter of it tightens every key.
Written once in each document,
as a def.
Declared once, used at many keys.
A shape stands alone: it names nothing else.
In Smithy's sense all three are shapes;
#[Shape] names the third kind, one
scalar value.
A resource is a thing with identity and storage that operations read and write, so it is the one of the three a caller reaches on its own. A structure is a group of keys only ever held by something else: it has no permission of its own, but it may answer access for its keys. A shape is one named value declared once and used at many keys, each of which may only narrow it.
Read more Glossary , Resources and structures , Named shapes . Decisions Resources, structures and operations , A shape is a named definition .