Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# @codama/spec

## 2.0.0-rc.0

### Major Changes

- [#137](https://github.com/codama-idl/spec/pull/137) [`dbeced1`](https://github.com/codama-idl/spec/commit/dbeced1ee4672dfa44dcc76138e2bb2e10c5ec72) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Allow any type node as account data. `accountNode.data` now accepts every member of the `typeNode` union — links included — aligning it with `eventNode.data`, so accounts can be non-structs or reuse a shared defined type via `definedTypeLinkNode`.

**BREAKING CHANGES**

**`accountNode.data` widens from `structTypeNode` to `typeNode`.** Consumers can no longer assume account data is a struct; nodes that reference account fields by name (`accountFieldValueNode`, `fieldDiscriminatorNode`, PDA seed defaults) are only valid when the data type resolves to a struct, following links — a constraint enforced by validators rather than by the spec shape.

```diff
accountNode({
name: 'mint',
- data: structTypeNode([/* fields copied from the shared type */]),
+ data: definedTypeLinkNode('mintState'),
});
```

- [#136](https://github.com/codama-idl/spec/pull/136) [`e6f9c63`](https://github.com/codama-idl/spec/commit/e6f9c63de4e06b67005aa1700dce1637065afb26) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Replace the nested type wrappers with a flat `transforms` array. The seven wrapper type nodes (`fixedSizeTypeNode`, `sizePrefixTypeNode`, `preOffsetTypeNode`, `postOffsetTypeNode`, `sentinelTypeNode`, `hiddenPrefixTypeNode`, `hiddenSuffixTypeNode`) and the `nestedTypeNode` recursive alias are removed. Instead, a new `transform` category defines one transform node per former wrapper (same attributes minus the inner type), and every member of the `typeNode` union — links included — carries an optional `transforms` array, applied in order with the first transform innermost. A type's `kind` is now stable whether or not it is modified, and attributes that pinned a wrapped inner kind (`accountNode.data`, enum variant payloads, numeric prefixes) become plain node references.

- [#138](https://github.com/codama-idl/spec/pull/138) [`996c20a`](https://github.com/codama-idl/spec/commit/996c20acbf7d4376beda23b02f3935e90e87020d) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Unify enum variants into a single `enumVariantTypeNode` with an optional `data` payload. The node also gains an optional `docs` attribute, closing the gap where enum variants could not carry documentation.

**BREAKING CHANGES**

**`enumEmptyVariantTypeNode`, `enumStructVariantTypeNode` and `enumTupleVariantTypeNode` are replaced by `enumVariantTypeNode`.** Absent `data` is a unit variant; a struct payload gives named fields, a tuple payload gives positional fields, and any other type node is carried as-is. The `name`, optional `discriminator` and optional `display` attributes carry over unchanged; the former `struct`/`tuple` attributes both become `data`. When upgrading, a v1 tuple variant holding exactly one item should unwrap to that single type — the 1-tuple was the workaround spelling of a single-type payload — **unless** the item is a `structTypeNode`, `tupleTypeNode` or `definedTypeLinkNode`: those shapes determine the variant flavour in `data` position, so unwrapping them would change the generated API (e.g. `V(InlineStruct)` becoming `V { … }`) even though the wire format is identical. Renderers whose target requires a wrapper (e.g. Rust) re-wrap single-type payloads on their side.

```diff
enumTypeNode([
- enumEmptyVariantTypeNode('flip'),
- enumTupleVariantTypeNode('rotate', tupleTypeNode([numberTypeNode('u32')])),
- enumStructVariantTypeNode('move', structTypeNode([/* … */])),
+ enumVariantTypeNode('flip'),
+ enumVariantTypeNode('rotate', numberTypeNode('u32')),
+ enumVariantTypeNode('move', structTypeNode([/* … */])),
]);
```

**The `enumVariantTypeNode` union no longer exists.** The name now identifies the node itself; `enumTypeNode.variants` is an array of that node, and the `registeredTypeNode` union references it directly.

- [#139](https://github.com/codama-idl/spec/pull/139) [`ab4e253`](https://github.com/codama-idl/spec/commit/ab4e253b73b959df48cdb08eb09ff3b7bb4a3589) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Remove the `origin` attribute from `programNode` and the `programOrigin` enumeration. The attribute recorded which toolchain generated the description from a closed whitelist (`anchor`/`shank`) that cannot keep up with an open ecosystem, described provenance rather than the program itself, and went stale as IDLs were edited after generation.

**BREAKING CHANGES**

**`programNode.origin` and the `programOrigin` enumeration are removed.** Tools that need provenance metadata can attach it via the universal `plugins` list instead.

```diff
programNode({
name: 'myProgram',
- origin: 'anchor',
+ plugins: [pluginNode('anchor')],
// ...
});
```

- [#134](https://github.com/codama-idl/spec/pull/134) [`f14dd93`](https://github.com/codama-idl/spec/commit/f14dd9380c99c8d447571726049c84c27cf2876b) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Restructure the package for the one-major-per-line release model: the root entrypoint now hosts the current major's spec surface from `src/spec/` (formerly `src/v1/`), the `./v1` subpath export is removed (the v1 spec remains available as `@codama/spec@^1` from the `1.x` line), and the generated artifacts move from `v1/` to the repository root (`spec.json`, `schema.json`, `docs/`). The generated docs landing page now links to the docs of previous majors on their maintenance branches.

- [#135](https://github.com/codama-idl/spec/pull/135) [`f9cfe95`](https://github.com/codama-idl/spec/commit/f9cfe957deef47d58b6a38fdf3a95adfa35f4026) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Give every node a `plugins` list via a new base-attribute mechanism. The meta-model's `Spec` type gains an optional `base` block (authored with the new `defineBase` helper) declaring attributes shared by every node; codegen targets append them after each node's declared attributes, so they always serialise last. The spec declares one base attribute — `plugins`, an optional array of `pluginNode` — making every node extensible with namespaced, consumer-defined data. `instructionNode` no longer declares `plugins` locally (the universal base attribute replaces it), and `validate` rejects base attributes that collide with declared attributes or carry unresolved references.

- [#105](https://github.com/codama-idl/spec/pull/105) [`ca0e36e`](https://github.com/codama-idl/spec/commit/ca0e36e87c879ad0f02a6c3df0f852a080068707) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Start Codama IDL v2. This is the beginning of the v2 line of the Codama standard; release candidates publish under the `rc` dist-tag while the spec evolves.

## 1.9.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The canonical Codama node specification.

Spec version: 1.9.2 · Other majors: [v1](https://github.com/codama-idl/spec/blob/1.x/v1/docs/README.md)
Spec version: 2.0.0-rc.0 · Other majors: [v1](https://github.com/codama-idl/spec/blob/1.x/v1/docs/README.md)

Pages marked _(abstract)_ document unions: sets of nodes that can be used interchangeably.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codama/spec",
"version": "1.9.2",
"version": "2.0.0-rc.0",
"description": "The canonical Codama node specification and meta-model",
"keywords": [
"codama",
Expand Down
2 changes: 1 addition & 1 deletion spec.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.9.2",
"version": "2.0.0-rc.0",
"base": {
"docs": [
"Attributes shared by every node.",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

/** The version string of the spec - always equal to the package version. */
export const SPEC_VERSION = '1.9.2';
export const SPEC_VERSION = '2.0.0-rc.0';