Today in v1
The spec defines a pluginNode — a named bag of consumer-defined data that Codama carries through the graph verbatim:
But only instructionNode has a plugins attribute to attach them to. Custom data cannot be attached to accounts, types, errors, programs, or the root. codama-idl/codama#73 asked for plugins on RootNode alone; this proposal generalises it to every node.
Proposal
Two changes, one to the meta-model and one to the v2 spec content:
1. Base attributes in the meta-model. The Spec type gains an optional base block declaring attributes that every node has. Codegen targets append them after each node's declared attributes and may emit a shared BaseNode interface. This is version-agnostic and additive: v1 declares no base attributes and is unaffected.
interface Spec {
version: string;
base?: { attributes: AttributeSpec[] };
categories: CategorySpec[];
}
2. v2 declares one base attribute: plugins, an optional array of pluginNode, on every single node.
Decisions
Open question
Should docs also become a base attribute, giving every node documentation? Today some nodes (most type nodes) have no docs attribute at all.
Migration
upgradeV1ToV2 copies instructionNode.plugins as-is; no other v1 node carries plugins.
Part of #102 — Tier A.
Today in v1
The spec defines a
pluginNode— a named bag of consumer-defined data that Codama carries through the graph verbatim:{ "kind": "pluginNode", "name": "explorerHints", "payload": { "icon": "transfer-arrow" } }But only
instructionNodehas apluginsattribute to attach them to. Custom data cannot be attached to accounts, types, errors, programs, or the root. codama-idl/codama#73 asked for plugins onRootNodealone; this proposal generalises it to every node.Proposal
Two changes, one to the meta-model and one to the v2 spec content:
1. Base attributes in the meta-model. The
Spectype gains an optionalbaseblock declaring attributes that every node has. Codegen targets append them after each node's declared attributes and may emit a sharedBaseNodeinterface. This is version-agnostic and additive: v1 declares no base attributes and is unaffected.2. v2 declares one base attribute:
plugins, an optional array ofpluginNode, on every single node.{ "kind": "errorNode", "name": "invalidAmount", "code": 6000, "message": "Amount must be greater than zero.", "plugins": [{ "kind": "pluginNode", "name": "explorerHints", "payload": { "severity": "warning" } }] }Decisions
pluginsalways comes last. The existing empty-array convention applies: an absentpluginsmeans "none".has_oneconstraints ([nodes] has_one account resolution codama#605).namebecomes a dot-separated namespace (e.g.i18n.es) — specified in [v2] Rename name to identifier and drop the casing mandate #129.Open question
Should
docsalso become a base attribute, giving every node documentation? Today some nodes (most type nodes) have nodocsattribute at all.Migration
upgradeV1ToV2copiesinstructionNode.pluginsas-is; no other v1 node carries plugins.Part of #102 — Tier A.