Skip to content

fix: case when message is oneOf for one element - #554

Merged
asyncapi-bot merged 2 commits into
asyncapi:masterfrom
Tenischev:fix_case_with_one_message_in_one_of
May 24, 2022
Merged

asyncapi-bot merged 2 commits into
asyncapi:masterfrom
Tenischev:fix_case_with_one_message_in_one_of

Conversation

@Tenischev

Copy link
Copy Markdown
Contributor

Description

If message object is

      message:
        oneOf:
          - $ref: '#/components/messages/ixOtaResponse'

Then parser will return

channel.subscribe().hasMultipleMessages() => false
channel.subscribe().messages() => [ Message{ ... } ]
channel.subscribe().message() => Message{ ... }

Related issue(s)
Fixes #475

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide 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.

@derberg derberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

anything from you @magicmatatjahu ? as I saw you commenting on the issue

@magicmatatjahu magicmatatjahu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, that logic bites me a little bit, because if someone passes message(2), it should return null, but because of the lines

if (!this._json.message.oneOf) return new Message(this._json.message);

I accept this solution because this function has bad logic from the beginning anyway.

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@magicmatatjahu

Copy link
Copy Markdown
Member

/rtm

@asyncapi-bot
asyncapi-bot merged commit 48d8708 into asyncapi:master May 24, 2022
@asyncapi-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.15.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asyncapi-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.0.0-next-major.18 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent behavior of message/messages/hasMultipleMessages

4 participants