feat: add $message expression and payload source (Arazzo 1.1.0)#146
Merged
Conversation
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>
There was a problem hiding this comment.
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-referenceandMessageExpression. - 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
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
Member
Author
|
🎉 This PR is included in version 3.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 newsourcealternative alongsideheader/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 andpayload-referencerule (+ recompiledsrc/grammar.js)src/parse/translators/CSTTranslator.js— registerpayload-referencecallbacksrc/parse/translators/ASTTranslator/transformers.js— addMessageExpressionandPayloadReferencetransformerstypes/index.d.ts— addMessageExpression,PayloadReference; extendReferenceandASTNodeunionsREADME.md— sync grammar block and add a$message.payloadexample rowtest/fixtures/expressions-valid.js,test/test.js— new fixtures/assertions for$message(header/query/path/body/payload, with and without JSON Pointer)Test plan
$message/payloadfixtures$message.payload#/user/idparses toMessageExpression → Source → PayloadReference → JsonPointer; embedded extraction{$message.payload#/user/id}works; invalid forms ($message.,{/}in pointer) correctly rejectedtscerrors introduced (the two pre-existingtypes/index.d.tserrors are unrelated and present onmain)🤖 Generated with Claude Code