feat(v3): auto-fill channel parameters from message location (#139) - #328
Merged
Merged
Conversation
Channel parameters that declare a `location` runtime expression were parsed but ignored. The generated send functions now derive such a parameter from the outgoing message (payload or header) when the caller leaves it empty, while keeping it overridable. Reuses the same location-tree machinery as correlation IDs / reply addresses, and adds a Follow() method to Parameter. Fixes #139 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Issue
Fixes #139 — a channel parameter's
locationruntime expression was parsed but never used; the parameter always had to be passed manually when sending.Change
When a channel parameter declares a
location($message.payload#/...or$message.header#/...), the generatedSend/Requestfunctions now derive it from the outgoing message when the caller leaves it empty, while keeping it overridable:This reuses the existing location-tree machinery (
createTreeUntilLocation,referenceToStructAttributePath) already used for correlation IDs and reply addresses.Operation.setParametersLocationDependenciesresolves the targeted field on the operation message and records whether it is required (pointer vs. value). AFollow()method was added toParameter. The feature is send-side only (on receive the message does not exist yet).Because no existing spec used parameter
location,go generate ./...produces no golden-file diff outside the new test.Test
test/v3/issues/139sends through a capturing mock broker (no real broker needed) and asserts the published address isv3.issue139.user.abcwhenuserIdis left empty (filled from the payload), and...overridewhen set explicitly. The first assertion fails before the change (empty parameter ⇒v3.issue139.user.).🤖 Generated with Claude Code