Skip to content

1. The two forms

Identical declarations.

types/movies.yml
- name: MovieRating
properties:
imdbId:
identity: true
description: "The rated film's IMDb id."
rating:
type: int
description: "1–10."
src/api/movies.ts
import { Entity } from "@embabel/runtime-types";
import { Id, Node, Property } from "@embabel/runtime-types/decorators";
@Node()
export class MovieRating extends Entity {
/** The rated film's IMDb id. */
@Id() declare imdbId: string;
/** 1–10. */
@Property({ type: "int" }) declare rating: number;
}

Guarantee — the forms are equivalent. A type declared either way is the same type: same label, same identity key, same properties, same behaviour at query and dispatch time. A realm may use both, for different types. Nothing about a consuming query or a calling model can tell which was used.

Guarantee — declarations do not execute. The decorators are read when the realm is built and are gone before any realm code runs. A decorator argument must be a literal; you cannot compute one, and you must not rely on side effects from one.