Skip to content

Operation channel ref to external asyncapi #136

Description

@gulecroc

Hi @ivangsa

I would like to know if it's possible to ref the operation channel to an external asyncapi ?

  • common-asyncapi.yaml :
asyncapi: 3.1.0
info:
  title: common
  version: 1.0.0

channels:
  sampleChannel:
    address: sample.topic
    messages:
      SampleMessage:
        $ref: '#/components/messages/SampleMessage'

components:
  messages:
    SampleMessage:
      name: SampleMessage
      payload:
        $ref: '#/components/schemas/SamplePayload'

  schemas:
    SamplePayload:
      type: object
  • client-a-asyncapi.yaml KO (ref to external channel) :
asyncapi: 3.1.0
info:
  title: client-a operations
  version: 1.0.0

operations:
  publishSample:
    action: send
    channel:
      $ref: 'common-asyncapi.yaml#/channels/sampleChannel'
    messages:
      - $ref: 'common-asyncapi.yaml#/channels/sampleChannel/messages/SampleMessage'

Error :

java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "messages" is null
    at io.zenwave360.sdk.processors.AsyncApiProcessor.process (AsyncApiProcessor.java:178)
    at io.zenwave360.sdk.MainGenerator.generate (MainGenerator.java:58)
    at io.zenwave360.sdk.GeneratorMojo.execute (GeneratorMojo.java:150)
  • client-a-asyncapi.yaml OK (ref to internal channel) :
asyncapi: 3.1.0
info:
  title: client-a operations
  version: 1.0.0

channels:
  sampleChannel:
    $ref: 'common-asyncapi.yaml#/channels/sampleChannel'

operations:
  publishSample:
    action: send
    channel:
      $ref: '#/channels/sampleChannel'
    messages:
      - $ref: '#/channels/sampleChannel/messages/SampleMessage'

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions