openapi: 3.0.0
info:
  title: 'Tome of Everlasting Dungeons'
  version: ''
  description: 'Tools, links, resources, APIs, and more to help you run your Dungeons and Dragons games.'
servers:
  - url: 'https://dnd.mlo.io/api'
  - url: 'http://localhost:4000/api'
    description: local
tags:
  - name: Spells
  - name: Items
paths:
  /spells.json:
    get:
      summary: Spell List
      tags:
        - Spells
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  spells:
                    type: array
                    items:
                      $ref: '#/components/schemas/Spell'
      operationId: spells.list
      description: Return all spells
  '/spells/class/{class}.json':
    parameters:
      - schema:
          type: string
          enum:
            - bard
            - cleric
            - druid
            - paladin
            - ranger
            - sorcerer
            - warlock
            - wizard
        name: class
        in: path
        required: true
        description: ''
    get:
      summary: Spells by Class
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  spells:
                    type: array
                    items:
                      $ref: '#/components/schemas/Spell'
      operationId: spells.class
      description: List spells by class
      tags:
        - Spells
  '/spells/level/{level}.json':
    parameters:
      - schema:
          type: string
          enum:
            - cantrip
            - 1st
            - 2nd
            - 3rd
            - 4th
            - 5th
            - 6th
            - 7th
            - 8th
            - 9th
        name: level
        in: path
        required: true
    get:
      summary: Spells by Level
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  spells:
                    type: array
                    items:
                      $ref: '#/components/schemas/Spell'
      operationId: spells.level
      description: List spells by level
      tags:
        - Spells
  /items.json:
    get:
      summary: Item List
      tags:
        - Items
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/Item'
      operationId: item.list
      description: Return all items
  '/items/rarity/{rarity}.json':
    get:
      summary: Items by Rarity
      tags:
        - Items
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/Item'
      operationId: items.rarity
      description: List items by rarity
    parameters:
      - schema:
          type: string
          enum:
            - common
            - uncommon
            - rare
            - very-rare
            - legendary
        name: rarity
        in: path
        required: true
  '/items/type/{type}.json':
    parameters:
      - schema:
          type: string
          enum:
            - armor
            - potion
            - ring
            - rod
            - scroll
            - staff
            - wand
            - weapon
            - wondrous
        name: type
        in: path
        required: true
    get:
      summary: Items by Type
      tags:
        - Items
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    $ref: '#/components/schemas/Item'
      operationId: items.type
      description: List items by type
components:
  schemas:
    Spell:
      title: Spell
      type: object
      x-examples: {}
      properties:
        spell:
          type: string
        level:
          type: integer
          minimum: 0
          maximum: 9
        school:
          type: string
          enum:
            - abjuration
            - conjuration
            - divination
            - enchantment
            - evocation
            - illusion
            - necromancy
            - transmutation
        class:
          type: array
          items:
            type: string
            enum:
              - Bard
              - Cleric
              - Druid
              - Paladin
              - Ranger
              - Sorcerer
              - Warlock
              - Wizard
        time:
          type: string
        range:
          type: string
        components:
          type: string
        duration:
          type: string
        ritual:
          type: boolean
        concentration:
          type: boolean
        description:
          type: string
    Item:
      title: Item
      type: object
      properties:
        item:
          type: string
        type:
          type: string
          enum:
            - Armor
            - Potion
            - Ring
            - Rod
            - Scroll
            - Staff
            - Wand
            - Weapon
            - Wondrous item
        subtype:
          type: string
          nullable: true
        rarity:
          type: string
        attunement:
          oneOf:
            - type: string
            - type: boolean
