Skip to content

Message Identification when oneOf is expected #1095

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

Open
crazyash opened this issue Mar 27, 2025 · 3 comments
Open

Message Identification when oneOf is expected #1095

crazyash opened this issue Mar 27, 2025 · 3 comments
Labels
❔ Question A question about the spec or processes

Comments

@crazyash
Copy link

I have an asyncapi, similar to the one below. Is there a standard way to identify the message that we receive in the channel?

For instance, In the below example, how to identify the message sent on test2 channel? How do we know if it's objectWithKey or objectWithKey2?

asyncapi: 3.0.0
info:
  title: OneOf example
  version: 1.0.0
channels:
  test:
    address: test
    messages:
      testMessages:
        $ref: '#/components/messages/testMessages'
  test2:
    address: test2
    messages:
      objectWithKey:
        payload:
          $ref: '#/components/schemas/objectWithKey'
      objectWithKey2:
        payload:
          $ref: '#/components/schemas/objectWithKey2'
operations:
  onTestMsg:
    action: receive
    channel:
      $ref: '#/channels/test'
    messages:
      - $ref: '#/channels/test/messages/testMessages'
  sendTest:
    action: send
    channel:
      $ref: '#/channels/test2'
    messages:
      - $ref: '#/channels/test2/messages/objectWithKey'
      - $ref: '#/channels/test2/messages/objectWithKey2'
components:
  messages:
    testMessages:
      payload:
        oneOf:
          - $ref: '#/components/schemas/objectWithKey'
          - $ref: '#/components/schemas/objectWithKey2'
    testMessage1:
      payload:
        $ref: '#/components/schemas/objectWithKey'
    testMessage2:
      payload:
        $ref: '#/components/schemas/objectWithKey2'
  schemas:
    objectWithKey:
      type: object
      properties:
        key:
          type: string
    objectWithKey2:
      type: object
      properties:
        key2:
          type: string
@crazyash crazyash added the ❔ Question A question about the spec or processes label Mar 27, 2025
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.

@AnEngg
Copy link

AnEngg commented Apr 8, 2025

asynapisolution.pdf

@kanchandeshmukh148
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔ Question A question about the spec or processes
Projects
None yet
Development

No branches or pull requests

3 participants