Skip to content

[Bug] Incorrect server rendering in AsyncAPI v3: protocol prefix added (kafka://) instead of just host #658

@sahillllllllll-bit

Description

@sahillllllllll-bit

Describe the bug.

When generating Markdown documentation from an AsyncAPI v3.0.0 specification using @asyncapi/markdown-template@2.0.0, the server section renders the full URL with protocol prefix (e.g., kafka://kafka.example.com:9092/) instead of just the host value as defined in the v3 spec (kafka.example.com:9092).

This is incorrect because AsyncAPI v3.0.0 uses separate host (required) and pathname (optional) fields, with protocol separate — no combined url with protocol prefix like in v2.

Expected behavior

The server should render as:
Host: kafka.example.com:9092
Protocol: kafka

No kafka:// prefix or trailing / should appear unless pathname is defined.

Screenshots

Image

How to Reproduce

  1. Use this minimal AsyncAPI v3.0.0 YAML file (asyncapi.yaml):
asyncapi: '3.0.0'
id: 'urn:example:com:demo:app'
info:
  title: Demo Event-Driven API
  version: '1.0.0'
servers:
  production:
    host: kafka.example.com:9092
    protocol: kafka
    description: Production Kafka broker
channels:
  userSignedUp:
    address: user/signedup
    messages:
      UserSignedUp:
        $ref: '#/components/messages/UserSignedUp'
operations:
  sendUserSignedUp:
    action: send
    channel:
      $ref: '#/channels/userSignedUp'
    messages:
      - $ref: '#/channels/userSignedUp/messages/UserSignedUp'
components:
  messages:
    UserSignedUp:
      name: UserSignedUp
      title: User Signed Up Event
      contentType: application/json
      payload:
        type: object
        properties:
          userId: { type: string, description: Unique user identifier }
          email: { type: string, format: email }
        required: [userId, email]

2 .Generate Markdown documentation using the latest template:

npx -p @asyncapi/cli \
  asyncapi generate fromTemplate \
  asyncapi.yaml \
  @asyncapi/markdown-template \
  -o output-md
  1. Open the generated file: output-md/asyncapi.md

Observed result:
In the Servers section, it shows:
URL: kafka://kafka.example.com:9092/
Expected:
Host: kafka.example.com:9092

🖥️ Device Information [optional]

  • Operating System (OS): Windows(WSL2)
  • Browser: Chrome(Latest)
  • Browser Version: Latest

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions