diff --git a/schemas/schema-schema.ipldsch b/schemas/schema-schema.ipldsch index 0ccc52a7..f550de4b 100644 --- a/schemas/schema-schema.ipldsch +++ b/schemas/schema-schema.ipldsch @@ -378,7 +378,15 @@ type UnionRepresentation union { ## ## The referenced type must of course produce the RepresentationKind it's ## matched with! -type UnionRepresentation_Kinded {RepresentationKind:TypeName} +type UnionRepresentation_Kinded {RepresentationKind:KindedType} + +## "KindedType" is used to allow inline link definitions within a kinded union +## as a shorthand rather than requiring all links be defined as a separate type +## before used within a kinded union. +type KindedType union { + | TypeName "string" + | TypeLink "link" +} representation kinded ## "Keyed" union representations will encode as a map, where the map has ## exactly one entry, the key string of which will be used to look up the name diff --git a/schemas/schema-schema.ipldsch.json b/schemas/schema-schema.ipldsch.json index 35848f48..f0b93a16 100644 --- a/schemas/schema-schema.ipldsch.json +++ b/schemas/schema-schema.ipldsch.json @@ -308,7 +308,16 @@ "UnionRepresentation_Kinded": { "kind": "map", "keyType": "RepresentationKind", - "valueType": "TypeName" + "valueType": "KindedType" + }, + "KindedType": { + "kind": "union", + "representation": { + "kinded": { + "string": "TypeName", + "link": "TypeLink" + } + } }, "UnionRepresentation_Keyed": { "kind": "map",