asyncapi / go-watermill-template

Go template for the AsyncAPI Generator using Watermill module
Apache License 2.0
49 stars 16 forks source link

Failure to generate AMQP channel bindings without queue definition #180

Closed tommitytom closed 1 year ago

tommitytom commented 1 year ago

Describe the bug

In the AMQP documentation, it states that an AMQP binding can be set up for a channel as either a routingKey (exchange) or a queue, set via the is key. https://github.com/asyncapi/bindings/blob/master/amqp/README.md#channel-binding-object

This would lead me to believe that a channel binding can only be one or the other. I'm trying to set up a channel that interacts with a RabbitMQ exchange, so I am leaving out the queue definition as I presume it is not needed, however this causes the following crash:

Something went wrong:
TypeError: Cannot read properties of undefined (reading 'name')
    at map (C:\Users\Tom\AppData\Roaming\npm\node_modules\@asyncapi\generator\node_modules\@asyncapi\go-watermill-template\components\Router.js:18:23)
    at Array.map (<anonymous>)
    at AMQPRouterRules (C:\Users\Tom\AppData\Roaming\npm\node_modules\@asyncapi\generator\node_modules\@asyncapi\go-watermill-template\components\Router.js:15:6)
    at createElement (C:\Users\Tom\AppData\Roaming\npm\node_modules\@asyncapi\generator\node_modules\@asyncapi\generator-react-sdk\src\renderer\renderer.ts:46:26)
    at Object.render (C:\Users\Tom\AppData\Roaming\npm\node_modules\@asyncapi\generator\node_modules\@asyncapi\generator-react-sdk\src\renderer\renderer.ts:74:16)

How to Reproduce

Create a channel with an AMQP binding without a queue definition, like the following:

channels:
  user/signedup:
    bindings:
      amqp:
        is: routingKey
        exchange:
          name: myExchange
          type: topic
          durable: true
          autoDelete: false
          vhost: /
        bindingVersion: 0.2.0

Expected behavior

I expected the code to be generated without error. The definition works fine with the HTML documentation generator.

github-actions[bot] commented 1 year ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup 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.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart: