Skip to content

Relations

Relations are defined as relation-type properties in type schemas. They let you connect objects with named links.

.typemd/types/book.yaml
name: book
properties:
- name: title
type: string
- name: author
type: relation
target: person
bidirectional: true
inverse: books
.typemd/types/person.yaml
name: person
properties:
- name: name
type: string
- name: books
type: relation
target: book
multiple: true
bidirectional: true
inverse: author
FieldDescription
targetTarget object’s type name
multipleWhether the property holds multiple values (array)
bidirectionalAuto-sync the inverse side when linking
inverseProperty name on the target type’s schema
Terminal window
tmd link book/golang-in-action author person/alan-donovan

When bidirectional: true, this automatically updates both the book’s author and the person’s books property.

Terminal window
tmd unlink book/golang-in-action author person/alan-donovan --both

Use --both to remove the inverse side as well.