Skip to content

[BUG] moveAllComponents is not working as expected. #261

Description

@KhudaDad414

Describe the bug.

I tried to run the optimizer on this file:

asyncapi: 3.0.0
info:
  title: Account Service
  version: "1.0"
channels:
  userSignedUp:
    address: user/signedup
    messages:
      UserSignedUp:
        $ref: '#/components/messages/UserSignedUp'
components:
  messages:
    UserSignedUp:
      payload:
        type: object
        properties:
          email:
            type: string

It generated the following invalid document.

asyncapi: 3.0.0
info:
  title: Account Service
  version: '1.0'
channels:
  userSignedUp:
    $ref: '#/components/channels/userSignedUp'
components:
  messages:
    UserSignedUp:
      payload:
        type: object
        properties:
          email:
            type: string
  schemas: {}
  channels:
    userSignedUp:
      address: user/signedup
      messages:
        UserSignedUp:
          $ref: '#/components/messages/UserSignedUp'
          payload:
            properties:
              email:
                $ref: '#/components/schemas/email'

Expected behavior

It should have generated:

asyncapi: 3.0.0
info:
  title: Account Service
  version: "1.0"
channels:
  userSignedUp:
    address: user/signedup
    messages:
      UserSignedUp:
        $ref: '#/components/messages/UserSignedUp'
components:
  schemas:
    email:
      type: string
  messages:
    UserSignedUp:
      payload:
        type: object
        properties:
          email: "$ref: #/components/schemas/email"

Screenshots

...

How to Reproduce

Run the optimiser on the given AsyncAPI file.

🥦 Browser

None

👀 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

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions