FabricFabricPlatform
Platform referenceEntities

Typed object definitions

Declare portable JSON Schema, qualified relations, semantic annotations, and enforcement-owned invariants on Fabric object types.

Manifest v2 lets an object registration carry portable meaning while preserving the original string form. Existing objectTypes: ["Order"] declarations remain valid.

const ordersModule = {
  namespace: "orders",
  objectTypes: [{
    type: "Order",
    schema: {
      type: "object",
      required: ["customerId", "status"],
      properties: {
        customerId: { type: "string" },
        status: { enum: ["draft", "submitted"] },
      },
      additionalProperties: false,
    },
    semantics: {
      "example.classification": { version: "1", value: "commercial" },
    },
    relations: [{
      name: "customer",
      target: "identity.Party",
      cardinality: "one",
      required: true,
      semantics: "reference",
      onTargetDelete: "restrict",
    }],
    invariants: [{
      id: "order.customer-required",
      description: "Every order identifies its customer",
      required: true,
      enforcement: "json-schema",
      enforcementRef: "#/required/customerId",
    }],
  }],
} satisfies FabricModule;

Portable JSON Schema profile

PortableJsonSchema is a dependency-free subset of JSON Schema covering object, array, scalar, composition, numeric, string, and annotation keywords. Unknown portable extensions must start with x-. Registration rejects unsupported keywords instead of silently publishing a contract that different consumers may interpret differently.

Entity schemas are definition-time contracts. They do not prove that arbitrary writes through the application-owned TDb were validated. A Host/database adapter must explicitly validate persisted entities before making that claim.

Qualified relations

Relation targets use <module-namespace>.<ObjectType>. Bare type names are rejected. A relation states cardinality, whether it is required, whether it owns or references the target, and deletion behavior.

Optional reference cycles are valid. Registration rejects module-dependency, owned-containment, cascade-delete, and required-construction cycles. Required references participate because neither side can be constructed first without an application-specific deferral. A required relation cannot use set-null.

Semantic annotations

semantics is namespaced JSON data. Platform validates that it is serializable but does not interpret the keys. Optional packages can provide typed authoring helpers and validators without adding their vocabulary to the portable runtime.

Invariants and enforcement

Every invariant names its enforcement owner. A required invariant must carry an enforcementRef pointing to the schema keyword, state machine, policy, Host adapter, or application evidence contract that enforces it. Declaring enforcement: "application" states ownership; it is not proof by itself. The compiler resolves required JSON Schema, state-machine, and policy references directly. Required Host-adapter or application-owned invariants pass certification only when the named CertificationProfile resolves their evidence; otherwise compilation fails closed.

On this page