Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Parsing yields error due to correlation between a Channel and Operation #996

Closed
2 tasks done
g-radam opened this issue May 24, 2024 · 1 comment · Fixed by #999
Closed
2 tasks done

[BUG] Parsing yields error due to correlation between a Channel and Operation #996

g-radam opened this issue May 24, 2024 · 1 comment · Fixed by #999
Labels
bug Something isn't working

Comments

@g-radam
Copy link

g-radam commented May 24, 2024

Describe the bug.

The parser yields an error due to some correlation between a Channel address being null and its associated Operation not having traits: [] defined. Either changing the address to be not-null, OR, adding a traits: [] field to the operation will suppress the error.

Note that Operation Traits are NOT required by the spec, so being forced to add a traits: [] field to an operation due to a channel address being null is quite erroneous. I have zero insight into where such an issue could be stemming from.

Expected behavior

Traits can be omitted from operations without an error, regardless of if the associated channel has a null address.

Screenshots

Studio link to the error

1:1	Error thrown during AsyncAPI document parsing.
Name: TypeError, message: Cannot read properties of null (reading 'traits'),
stack: TypeError: Cannot read properties of null (reading 'traits') at 
https://studio.asyncapi.com/static/js/main.827b380d.js:2:28752 at callback 
(https://studio.asyncapi.com/static/js/main.827b380d.js:2:28928) at _._handleCallback 
(https://studio.asyncapi.com/static/js/main.827b380d.js:2:3947909) at _._trace 
(https://studio.asyncapi.com/static/js/main.827b380d.js:2:3948061) at 
https://studio.asyncapi.com/static/js/main.827b380d.js:2:3948326 at 
https://studio.asyncapi.com/static/js/main.827b380d.js:2:3951499 at Array.forEach (<anonymous>) at _._walk 
(https://studio.asyncapi.com/static/js/main.827b380d.js:2:3951478) at _._trace 
(https://studio.asyncapi.com/static/js/main.827b380d.js:2:3948301) at _._trace 
(https://studio.asyncapi.com/static/js/main.827b380d.js:2:3948249)

How to Reproduce

Below is a minimal reproducible example:

asyncapi: 3.0.0
info:
  title: Acme Server API
  version: 1.0.0
channels:
  Exchange:
    address: nunotnullactually  <------------------- Make this null, and ensure there is NO `traits` on the operation, to cause the error
    messages:
      FooEvent:
        name: FooEvent
        title: Tenant Created
        contentType: application/json
        payload:
          type: string
operations:
  sendTenantCreated:
    title: Send tenant created event to client
    action: send
    #traits: []    <------------------------------------------ Adding this suppresses the error when address is null.
    channel:
      $ref: '#/channels/Exchange'
    messages:
      - $ref: '#/channels/Exchange/messages/FooEvent'

🥦 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

@g-radam g-radam added the bug Something isn't working label May 24, 2024
Copy link

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.

@g-radam g-radam changed the title [BUG] Parsing fails if a chan [BUG] Parsing yields error due to some correlation between a Channel and Operation May 24, 2024
@g-radam g-radam changed the title [BUG] Parsing yields error due to some correlation between a Channel and Operation [BUG] Parsing yields error due to correlation between a Channel and Operation May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant