ipld / specs

Content-addressed, authenticated, immutable data structures
Other
592 stars 108 forks source link

feat: allow inline link definitions for kinded unions #371

Open rvagg opened 3 years ago

rvagg commented 3 years ago

e.g.

type Foo union {
  | &Blip link
  | Blop string
} representation kinded

rather than having to type BlipLink &Blip before using it in a kinded union.


I've been using this pattern already, e.g. https://github.com/ipld/specs/blob/9bab36f7c256ae8ff14e0190ff0327e631ef2e15/data-structures/hashmap.md#L113-L116

I think I assumed we had this locked in but I guess we never got it into schema-schema. Without this, to use a link to another type you've defined, you have to make a new link type for it type HashMapNodeLink &HashMapNode.