Skip to content

[BUG] bundle creates invalid document (refs) #1989

@black-snow

Description

@black-snow

Describe the bug.

asyncapi bundle creates invalid documents.

main.yaml

asyncapi: 3.0.0
info:
  title: demo
  version: '1'
operations:
  A:
    $ref: "./_sub.yaml#/components/operations/A"
channels:
  A:
    $ref: "./_sub.yaml#/components/channels/A"

_sub.yaml

components:
  operations:
    A:
      action: send
      channel:
        $ref: '#/components/channels/A'
      messages:
        - $ref: '#/components/channels/A/messages/A'
  channels:
    A:
      messages:
        A:
          $ref: '#/components/messages/A'
  messages:
    A:
      payload:
        type: object
asyncapi validate main.yaml
asyncapi bundle ./main.yaml --output final.yml
asyncapi validate final.yml

produced invalid output:

asyncapi: 3.0.0
info:
  title: demo
  version: '1'
channels:
  A:
    messages:
      A:
        payload:
          type: object
operations:
  A:
    action: send
    channel:
      $ref: '#/components/channels/A'
    messages:
      - $ref: '#/components/channels/A/messages/A'

Expected behavior

It should've either updated the refs to root or moved the channels/ops/messages to components (if allowed).

Screenshots

How to Reproduce

see above

🖥️ Device Information [optional]

  • Operating System (OS): macOS latest
  • Browser: WF
  • 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 ?

No, someone else can work on it

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions