Skip to content

fix: validate that reply channels with dynamic address have null or undefined address (#876) - #1268

Open
joshi-07 wants to merge 1 commit into
asyncapi:masterfrom
joshi-07:feat/asyncapi3-operation-reply-address
Open

joshi-07 wants to merge 1 commit into
asyncapi:masterfrom
joshi-07:feat/asyncapi3-operation-reply-address

Conversation

@joshi-07

Copy link
Copy Markdown

Resolves #876

Description

According to the AsyncAPI 3.0.0 Specification (Section 4.3.4, Operation Reply Object):

If address is specified, the associated channel MUST NOT specify an address (i.e. its address property must be null or undefined).

Previously, the parser did not validate this condition, allowing documents with dynamic reply addresses (e.g. reply.address.location) pointing to channels with concrete addresses (e.g. address: 'user/signedup') to pass validation silently.

Changes

  • Implemented operationReplyAddress Spectral function under packages/parser/src/ruleset/v3/functions/operationReplyAddress.ts that resolves local component reference chains (resolveLocalReference) and asserts that if reply.address is specified, the associated channel's address is either null or omitted (undefined).
  • Registered asyncapi3-operation-reply-address in v3CoreRuleset (packages/parser/src/ruleset/v3/ruleset.ts) matching $.operations.*.reply and $.components.operations.*.reply.
  • Added unit tests in packages/parser/test/ruleset/rules/v3/asyncapi3-operation-reply-address.spec.ts covering root channels, component reference chains, inline channel objects, and positive/negative scenarios.
  • Updated userSignupReply in test/parse.spec.ts to use address: null so that test fixtures remain compliant with the v3 specification.
  • Added changeset for @asyncapi/parser (patch).

Verification

  • npm run lint: passed with 0 warnings
  • npm run build: passed across all 4 packages
  • npm run parser:test:unit: all 151 test suites and 2,538 tests passed with 100% coverage on operationReplyAddress.ts

@github-actions github-actions Bot 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.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@changeset-bot

changeset-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a9837b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/parser Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser do not validate if channel that is referenced in reply with location has null in address

1 participant