Skip to content

AsyncAPI: $ref in examples #838

Answered by lbroudoux
JulianGarciaDev asked this question in Q&A
Discussion options

You must be logged in to vote

I had a detailed look at it and I think this construction is not correct from an AsyncAPI schema point of view (not from a JSON point of view).

If you have a look at Operation object definition in the specification, it says message property is either Message Object | Reference Object | Map["oneOf", [Message Object | Reference Object]]

So you can define a message this way:

channels:
  user/signedup:
    subscribe:
      message:
        headers:
          [...]
        payload:
          [...]

that way:

channels:
  user/signedup:
    subscribe:
      message:
        $ref: '#/components/messages/UserSignedUp'

of

channels:
  user/signedup:
    subscribe:
      message:
        oneof:
    …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@lbroudoux
Comment options

@lbroudoux
Comment options

Answer selected by JulianGarciaDev
@JulianGarciaDev
Comment options

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