Skip to content

fix: expose server summary() on ServerInterface for v3 documents#1199

Open
AayushSaini101 wants to merge 1 commit into
asyncapi:masterfrom
AayushSaini101:1076
Open

fix: expose server summary() on ServerInterface for v3 documents#1199
AayushSaini101 wants to merge 1 commit into
asyncapi:masterfrom
AayushSaini101:1076

Conversation

@AayushSaini101

Copy link
Copy Markdown
Collaborator

Summary

Fixes #1076 by exposing server.summary() and server.hasSummary() on the
shared ServerInterface, with v3 test coverage.

Problem

AsyncAPI v3 defines an optional summary field on the Server Object, and the
v3 Server model already reads it via CoreModel. However, ServerInterface
did not include summary(), so TypeScript users accessing servers through
document.allServers() did not get proper type support for this method.

Why only ServerInterface needed to change

No changes to the v3 Server class were required because:

  • v3 Server extends CoreModel, which already implements hasSummary() and summary()
  • Parsing and model behavior already worked at runtime
  • The gap was only in the published TypeScript contract (ServerInterface)

Why v2 was not changed

  • AsyncAPI v2 Server Object does not include summary (only description, url, protocol, etc.)
  • AsyncAPI v3 Server Object does include summary
  • Updating the shared interface with required SummaryMixinInterface would force stub methods on v2 Server
  • Instead, Partial<SummaryMixinInterface> was used so:
    • v3 servers expose summary() as expected
    • v2 servers are not forced to implement a field that is not in the v2 spec
    • only packages/parser/src/models/server.ts needed a production code change

Changes

  • server.ts: extend ServerInterface with Partial<SummaryMixinInterface>
  • server.spec.ts (v3): unit tests for .summary() and absent summary
  • asyncapi.spec.ts (v3): test allServers() exposes summary
  • parse.spec.ts: integration test for v3 allServers().summary()

Test plan

  • v3 Server model unit tests pass
  • v3 AsyncAPIDocument allServers() test passes
  • v3 parse() integration test passes
  • TypeScript build passes without v2 changes

@changeset-bot

changeset-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 451224b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@sonarqubecloud

Copy link
Copy Markdown

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.

[BUG] Missing server.summary() function

1 participant