Schema for Ratatoskr Message Template

From MessageTemplate.schema.yaml (ratatoskr/MessageTemplate.schema)

---
$id: https://skeleton.botmd.io/ratatoskr/MessageTemplate.schema
$schema: http://json-schema.org/draft-07/schema#

title: Message Template
description: A convenience schema for representing a variety of message formats when editing via Mastermind.

oneOf:
  - title: No Message
    description: No message will be sent.

    enum: [false]

  - title: Text Message
    description: Simple text message to send.

    type: string
    minLength: 1

  - title: Array of Text Messages
    description: A text message will be uniformly selected from this array.

    type: array
    minItems: 1
    items:
      type: string
      minLength: 1

  - title: Message
    description: Ratatoskr [Message.schema](ratatoskr-message-generated.html) that will be sent to the user.

    $ref: "/ratatoskr/Message.schema"

  - title: Series of Messages
    description: Series of Ratatoskr [Message.schema](ratatoskr-message-generated.html)s will be sent to the user.

    type: array
    minItems: 1
    items:
      $ref: "/ratatoskr/Message.schema"

  - title: Random Choices
    description: Choose from one of the arrays of Ratatoskr [Message.schema](ratatoskr-message-generated.html)s randomly.

    type: object
    additionalProperties: false
    required: [choices]

    properties:
      choices:
        title: Choices
        description: Array of choices of messages to choose from.

        type: array
        minItems: 1
        items:
          type: object
          required: [messages]
          additionalProperties: false

          properties:
            messages:
              title: Messages
              description: An array of messages that form this random message choice.

              type: array
              minItems: 1
              items:
                $ref: "/ratatoskr/Message.schema"
            #end messages

            weight:
              title: Weight
              description: The relative weight of this message used to perform weighted choice. Defaults to `1`.
              type: number
              exclusiveMinimum: 0
          #end properties
        #end items
      #end choices
    #end properties
#end oneOf

[Main Page] [Schema Documentation] [Examples]