feat(v3): per-operation function name overrides (#162) - #327
Merged
Merged
Conversation
Add x-go-send-func, x-go-subscribe-func, x-go-received-func, x-go-reply-func and x-go-request-func operation extensions that override the Go names of the generated Subscribe/Received/Reply/Send/Request functions. When unset, the default derived names are used, so existing generated code is unchanged. Fixes #162 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lerenn
force-pushed
the
feat/162-func-name-overrides
branch
from
June 12, 2026 15:34
e0adf9d to
ad19b46
Compare
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 #162 — there was no way to override the Go names of the functions generated for an operation; they were always derived from the operation name.
Change
Adds five operation-level extensions (AsyncAPI v3) that each override one generated function name:
x-go-subscribe-funcSubscribeTo<Op>x-go-received-func<Op>Receivedsubscriber callbackx-go-reply-funcReplyTo<Op>x-go-send-funcSend{As,To}<Op>x-go-request-funcRequest{As,To}<Op>Each name is resolved through a template helper that returns the override (when set) or the exact previous default. Definitions, all call sites, and doc comments route through the helpers — including the internal reply-sender call, which resolves via the receive operation's
ReplyIsso request/reply cross-references stay consistent. Because the defaults are unchanged,go generate ./...produces no diff in existing golden files or examples.Test
test/v3/issues/162defines a request-replypingoperation carrying all five extensions. The suite implements the generatedAppSubscriberviaOnPingand referencesListenForPing/AnswerPing/PublishPing/AskPingas method expressions — it fails to compile before the change (those names don't exist) and passes after.🤖 Generated with Claude Code