asyncapi: 2.0.0
info:
  title: Record Label Service
  version: 1.0.0
  description: This service is in charge of processing music
servers:
  production:
    url: 'my-kafka-hostname:9092'
    protocol: kafka
    description: Production Instance 1
channels:
  song.metadata:
    publish:
      message:
        $ref: '#/components/messages/metadata'
    subscribe:
      message:
        oneOf:
          - $ref: '#/components/messages/success-response'
          - $ref: '#/components/messages/failure-response'
components:
  messages:
    success-response:
      payload:
        $id: SuccessResponse
        type: object
        properties:
          originalEventId:
            description: Id of the original Event
            type: string
          success:
            description: Shows whether or not the original Event was processed correctly
            type: boolean
            example: true
          meta:
            description: Meta-Information
            additionalProperties: true
    failure-response:
      payload:
        $id: FailureResponse
        type: object
        properties:
          originalEventId:
            description: Id of the original Event
            type: string
          success:
            description: Shows whether or not the original Event was processed correctly
            type: boolean
            example: false
          meta:
            description: Meta-Information
            additionalProperties:
              type: string
    metadata:
      payload:
        $id: SongMetaData
        type: object
        properties:
          tags:
            description: Tags
            additionalProperties:
              type: string
          stats:
            description: Stats
            additionalProperties:
              type: integer
              format: int64
          flags:
            description: Flags
            additionalProperties:
              type: boolean
          album:
            $ref: '#/components/schemas/Album'
          interprets:
            description: Interprets
            additionalProperties:
              $ref: '#/components/schemas/Interpret'
  schemas:
    emptyObject:
      type: object
      description: Test correct generation of object without parameters
    Album:
      description: Album
      type: object
      properties:
        name:
          description: Name of the album
          type: string
        year:
          description: Publishing year
          type: integer
      additionalProperties: false # do not allow for additional properties
    Interpret:
      type: object
      properties:
        name:
          description: Interpret name
          type: string
        meta:
          description: Meta-Information
          additionalProperties: true