AsyncAPI Domain Example

Below is an example of an AsyncAPI domain definition demonstrating various types of domain components.

See also: OpenAPI 2.0 Domain Example and OpenAPI 3.0 Domain Example

asyncapi: '2.4.0'

info:
  title: AsyncAPI Domain
  version: '1.0.0'
  description: An example domain for AsyncAPI

channels: {}
components:
  messages:
    exampleMessage:
      name: exampleMessage
      title: Example message
      summary: A message that shows a nice example.
      contentType: application/json
      traits:
        - $ref: '#/components/messageTraits/commonHeaders'
      payload:
        $ref: "#/components/schemas/exampleMessageSchema"

  schemas:
    exampleMessageSchema:
      type: object
      properties:
        text:
          type: string
          description: An example message.
        sentAt:
          $ref: "#/components/schemas/sentAt"

    sentAt:
      type: string
      format: date-time
      description: Date and time when the message was sent.

  parameters:
    parameterId:
      description: The ID of the parameter.
      schema:
        type: string

  messageTraits:
    commonHeaders:
      headers:
        type: object
        properties:
          my-app-header:
            type: integer
            minimum: 0
            maximum: 100

See Also

Publication date: