feat(asyncapi): add Follow() to remaining referenceable types (#146) - #329
Merged
Merged
Conversation
Several v3 types that carry a $ref (ChannelBindings, ExternalDocumentation, MessageBindings, MessageExample, OperationBindings, OperationReplyAddress, SecurityScheme, Server, ServerBindings, ServerVariable, Tag) and v2 Parameter had a ReferenceTo field but no Follow() helper. Add Follow() to each so referenced structures can be resolved uniformly, matching the types that already had it. Fixes #146 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lerenn
force-pushed
the
feat/146-follow-methods
branch
from
June 12, 2026 16:00
564409a to
a20ca6f
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 #146 — only some referenceable structures exposed a
Follow()helper to resolve a$ref. Many v3 types with aReferenceTofield (and v2Parameter) lacked one, so callers had to special-case them.Change
Adds a
Follow()method (returns the referenced value if set, otherwise the receiver) to every remaining type that has aReferenceTo:ChannelBindings,ExternalDocumentation,MessageBindings,MessageExample,OperationBindings,OperationReplyAddress,SecurityScheme,Server,ServerBindings,ServerVariable,TagParameterThis matches the pattern already used by
Channel,Message,Operation,Schema, etc. Purely additive —go generate ./...produces no diff. (CorrelationID.ReferenceTois typed*Channel, an anomaly left untouched here.)Test
pkg/asyncapi/v3/follow_test.goandpkg/asyncapi/v2/follow_test.goassertFollow()returns the receiver when there is no reference and the referent when one is set. They fail to compile before the change (methods undefined) and pass after.🤖 Generated with Claude Code