"$schema": "http://json-schema.org/draft-07/schema#"
"$id": "https://trovu.net/schema/shortcuts.yml"
title: Trovu shortcuts.yml
type: object
additionalProperties: false
patternProperties:
  '^[^ ]+ [0-9]+$':
    "$ref": "#/$defs/shortcutEntry"
"$defs":
  tag:
    type: string
    pattern: "^[^ _,;'\"\\[\\]{}*&^%$#@!<>?|\\\\/]+$"
  exampleConfig:
    type: object
    additionalProperties: false
    properties:
      country:
        type: string
      language:
        type: string
  exampleEntry:
    type: object
    additionalProperties: false
    properties:
      arguments:
        oneOf:
          - type: string
          - type: number
      query:
        type: string
      description:
        type: string
      config:
        "$ref": "#/$defs/exampleConfig"
    required:
      - description
  testEntry:
    type: object
    additionalProperties: false
    properties:
      arguments:
        oneOf:
          - type: string
          - type: number
      expect:
        type: string
    required:
      - expect
  includeObject:
    type: object
    additionalProperties: false
    properties:
      key:
        type: string
      namespace:
        type: string
    required:
      - key
  deprecatedObject:
    type: object
    additionalProperties: false
    properties:
      alternative:
        type: object
        additionalProperties: false
        properties:
          query:
            type: string
        required:
          - query
      created:
        type: string
        pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}$'
    required:
      - alternative
  shortcutObject:
    type: object
    additionalProperties: false
    properties:
      url:
        type: string
        pattern: '^https?://.*$'
      title:
        type: string
      description:
        type: string
      tags:
        type: array
        items:
          "$ref": "#/$defs/tag"
      examples:
        type: array
        items:
          "$ref": "#/$defs/exampleEntry"
      removed:
        type: string
        pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}$'
      include:
        oneOf:
          - type: string
          - "$ref": "#/$defs/includeObject"
          - type: array
            items:
              "$ref": "#/$defs/includeObject"
      deprecated:
        "$ref": "#/$defs/deprecatedObject"
      tests:
        oneOf:
          - type: string
          - type: array
            items:
              "$ref": "#/$defs/testEntry"
    anyOf:
      - properties:
          url:
            type: string
        required:
          - url
      - properties:
          include: {}
        required:
          - include
      - properties:
          deprecated: {}
        required:
          - deprecated
      - properties:
          removed:
            type: string
        required:
          - removed
  shortcutEntry:
    oneOf:
      - type: string
        pattern: '^https?://.*$'
      - "$ref": "#/$defs/shortcutObject"
