Skip to content

feat: add $message expression and payload source (Arazzo 1.1.0)#146

Merged
char0n merged 2 commits into
mainfrom
feat/message-payload-1.1.0
Jul 7, 2026
Merged

feat: add $message expression and payload source (Arazzo 1.1.0)#146
char0n merged 2 commits into
mainfrom
feat/message-payload-1.1.0

Conversation

@char0n

@char0n char0n commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Aligns the grammar with the released Arazzo 1.1.0 runtime expression ABNF. The initial 1.1.0 work (#116) inlined the reference grammars and added $self / JSON-Pointer support, but omitted two constructs that are part of the published 1.1.0 grammar:

  • $message.{source} expression — for event-driven (AsyncAPI) operations, mirroring $request. / $response.
  • payload-reference ("payload" ["#" json-pointer]) — a new source alternative alongside header / query / path / body, enabling $message.payload#/...

After this change, the grammar matches the 1.1.0 runtime-expression ABNF exactly.

Changes

  • src/grammar.bnf — add $message. alternative and payload-reference rule (+ recompiled src/grammar.js)
  • src/parse/translators/CSTTranslator.js — register payload-reference callback
  • src/parse/translators/ASTTranslator/transformers.js — add MessageExpression and PayloadReference transformers
  • types/index.d.ts — add MessageExpression, PayloadReference; extend Reference and ASTNode unions
  • README.md — sync grammar block and add a $message.payload example row
  • test/fixtures/expressions-valid.js, test/test.js — new fixtures/assertions for $message (header/query/path/body/payload, with and without JSON Pointer)

Test plan

  • All 169 tests pass
  • New CST/AST corpus snapshots generated for the $message/payload fixtures
  • Runtime smoke test: $message.payload#/user/id parses to MessageExpression → Source → PayloadReference → JsonPointer; embedded extraction {$message.payload#/user/id} works; invalid forms ($message., {/} in pointer) correctly rejected
  • No new tsc errors introduced (the two pre-existing types/index.d.ts errors are unrelated and present on main)

🤖 Generated with Claude Code

char0n and others added 2 commits July 7, 2026 09:26
Align the grammar with the released Arazzo 1.1.0 runtime expression
ABNF, which adds two constructs missing from the initial 1.1.0 work:

- $message.{source} expression (event-driven / AsyncAPI operations)
- payload-reference ("payload" ["#" json-pointer]) as a new source
  alternative alongside header/query/path/body

Grammar, CST callbacks, AST transformers (MessageExpression,
PayloadReference), TypeScript types, README grammar block/examples,
and test fixtures updated accordingly. All 169 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reorder grammar.bnf rules to mirror the published Arazzo 1.1.0
runtime-expression ABNF exactly, and match the spec's inner spacing
(`[ "#" json-pointer ]`, `1*( ... )`) and `identifier-strict`
alternation order. After this change, our rule definitions and their
order are a 1:1 transcription of the spec grammar, so future syncs are
a trivial diff.

Pure formatting/ordering change: recompiled grammar.js is behaviorally
identical and all 169 tests pass unchanged. README grammar block synced.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Arazzo runtime-expression grammar and AST/CST translators to support Arazzo 1.1.0’s $message.{source} expressions and the new payload-reference source (e.g., $message.payload#/...), and extends types/docs/tests accordingly.

Changes:

  • Extend the grammar ($message. + payload-reference) and regenerate the compiled grammar output.
  • Add CST/AST translation support for payload-reference and MessageExpression.
  • Expand TypeScript typings, fixtures, and snapshot coverage; update README examples.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/grammar.bnf Adds $message. expression alternative and payload-reference rule to match the 1.1.0 ABNF.
src/grammar.js Regenerated compiled grammar reflecting the updated ABNF.
src/parse/translators/CSTTranslator.js Registers payload-reference CST callback for tree generation.
src/parse/translators/ASTTranslator/transformers.js Adds MessageExpression and PayloadReference AST transformations.
types/index.d.ts Adds MessageExpression/PayloadReference types and extends unions to include them.
README.md Syncs the documented ABNF block and adds a $message.payload example row.
test/fixtures/expressions-valid.js Adds valid expression fixtures for $message.* and payload forms.
test/test.js Adds expression-detection assertions for $message and $self.
test/parse/__snapshots__/cst-corpus.js.snap Updates CST snapshots for newly supported $message expressions.
test/parse/__snapshots__/ast-corpus.js.snap Updates AST snapshots for newly supported $message expressions and payload references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@char0n char0n merged commit 87fad7a into main Jul 7, 2026
5 checks passed
@char0n char0n deleted the feat/message-payload-1.1.0 branch July 7, 2026 08:24
char0n pushed a commit that referenced this pull request Jul 7, 2026
# [3.0.0](v2.0.3...v3.0.0) (2026-07-07)

### Features

* add $message expression and payload source (Arazzo 1.1.0) ([#146](#146)) ([87fad7a](87fad7a))
* add support for Arazzo 1.1.0 ([#116](#116)) ([9bedacc](9bedacc))

### BREAKING CHANGES

* this changes the shape of AST, which warrants for a new major release
@char0n

char0n commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@char0n char0n added the released label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants