Skip to content

Inconsistent behavior of message/messages/hasMultipleMessages #475

Closed

Description

@Tenischev

Describe the bug

Result of message/messages/hasMultipleMessages operations looks inconsistent when deal with following strucuture:

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

This bug found during fix issue for java-spring-template - asyncapi-archived-repos/java-spring-template#156

How to Reproduce

  1. Parse schema where message defined like
      message:
        oneOf:
          - $ref: '#/components/messages/ixOtaResponse'
  1. Call for (assume that this message in subscribe, with publish behavior is the same)
channel.subscribe().hasMultipleMessages()
channel.subscribe().messages()
channel.subscribe().message()
  1. Actual result is
false
[
  Message {
    _json: {
      name: 'ixOtaResponse',
      title: '...',
      contentType: 'application/json',
      ...
      'x-parser-message-parsed': true
    }
  }
]
null

Expected behavior

If hasMultipleMessages() is false then message() shouldn't return null when messages() returns array with only one message
Expected out:

false
[
  Message {
    _json: {
      name: 'ixOtaResponse',
      title: '...',
      contentType: 'application/json',
      ...
      'x-parser-message-parsed': true
    }
  }
]
Message {
  _json: {
    name: 'ixOtaResponse',
    title: '...',
    contentType: 'application/json',
    ...
    'x-parser-message-parsed': true
  }
}

Activity

  1. added
    bug
    on Feb 19, 2022
  2. magicmatatjahu commented on May 19, 2022

    @magicmatatjahu
    Member

    @Tenischev Hello! Sorry for such a delay in response! Yeah, you're right, we have problem in logic https://github.com/asyncapi/parser-js/blob/master/lib/models/operation.js#L18 Would you like to create PR for that?

  3. Tenischev commented on May 20, 2022

    @Tenischev
    ContributorAuthor

    @magicmatatjahu Sure, soon will do it

  4. asyncapi-bot commented on May 25, 2022

    @asyncapi-bot
    Contributor

    🎉 This issue has been resolved in version 1.15.1 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  5. asyncapi-bot commented on Apr 24, 2023

    @asyncapi-bot
    Contributor

    🎉 This issue has been resolved 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleasedreleased on @next-major

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions