@@ -135,6 +135,18 @@ type RepresentationKind enum {
135135 | "link"
136136}
137137
138+ ## AnyScalar defines a union of the basic non-complex kinds.
139+ ##
140+ ## Useful defining usage of IPLD nodes that do compose from other nodes.
141+ ##
142+ type AnyScalar union {
143+ | Bool bool
144+ | String string
145+ | Bytes bytes
146+ | Int int
147+ | Float float
148+ } representation kinded
149+
138150## TypeBool describes a simple boolean type.
139151## It has no details.
140152##
@@ -178,15 +190,25 @@ type TypeList struct {
178190} representation map
179191
180192## TypeLink describes a hash linking to another object (a CID).
193+ ##
181194## A link also has an "expectedType" that provides a hinting mechanism
182195## suggesting what we should find if we were to follow the link. This
183196## cannot be strictly enforced by a node or block-level schema
184197## validation but may be enforced elsewhere in an application relying on
185198## a schema.
199+ ##
186200## The expectedType is specified with the `&Any` link shorthand, where
187201## `Any` may be replaced with a specific type.
202+ ##
203+ ## Unlike other kinds, we use `&Type` to denote a link Type rather than
204+ ## `Link`. In this usage, we replace `Type` the expected Type, with `&Any`
205+ ## being shorthand for "a link which may resolve to a type of any kind".
206+ ##
207+ ## `expectedType` is a String, but it should validate as "Any" or a TypeName
208+ ## found somewhere in the schema.
209+ ##
188210type TypeLink struct {
189- expectedType TypeTerm (implicit "Any")
211+ expectedType String (implicit "Any")
190212}
191213
192214## TypeUnion describes a union (sometimes called a "sum type", or
@@ -406,7 +428,7 @@ type StructRepresentation_Map struct {
406428##
407429type StructRepresentation_Map_FieldDetails struct {
408430 rename optional String
409- implicit optional Any # Review: may be better to introduce a small kinded union here which has the essential scalars as members.
431+ implicit optional AnyScalar
410432}
411433
412434## StructRepresentation_Tuple describes a way to map a struct type into a list
0 commit comments