{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://spectral.trade/docs/custom-indicators.schema.json",
  "title": "Spectral custom indicator manifest (schema v1, v2 and v3)",
  "description": "The literal fields of the default export of a Spectral custom indicator file. `calculate` is code and is not described here.",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "enum": [
        1,
        2,
        3
      ]
    },
    "id": {
      "type": "string",
      "minLength": 3,
      "maxLength": 48,
      "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "shortName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 20
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9A-Za-z.+-]{1,20}$"
    },
    "author": {
      "type": "string",
      "minLength": 1,
      "maxLength": 48
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 240
    },
    "pane": {
      "enum": [
        "price",
        "oscillator"
      ]
    },
    "live": {
      "description": "{ lookback }: a tick reruns calculate on the last lookback + 1 completed bars plus the forming bar (whole bars, or a sum of whole numbers, integer input keys with a max and N*key; at most 5,000 bars with those inputs at their max); barCloseWhen names settings that update at bar close only (a boolean input key, or { input, in } with some options of a select input). 'none': completed bars only. Omitted means { lookback: 0 }.",
      "oneOf": [
        {
          "enum": [
            "none"
          ]
        },
        {
          "type": "object",
          "properties": {
            "lookback": {
              "oneOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 5000
                },
                {
                  "type": "string",
                  "maxLength": 120,
                  "pattern": "^\\s*(?:(?:0|[1-9]\\d{0,3})\\s*\\*\\s*[a-z][A-Za-z0-9]{0,20}|[a-z][A-Za-z0-9]{0,20}|(?:0|[1-9]\\d{0,3}))(?:\\s*\\+\\s*(?:(?:0|[1-9]\\d{0,3})\\s*\\*\\s*[a-z][A-Za-z0-9]{0,20}|[a-z][A-Za-z0-9]{0,20}|(?:0|[1-9]\\d{0,3})))*\\s*$"
                }
              ]
            },
            "barCloseWhen": {
              "oneOf": [
                {
                  "type": "string",
                  "pattern": "^[a-z][A-Za-z0-9]{0,20}$"
                },
                {
                  "type": "object",
                  "properties": {
                    "input": {
                      "type": "string",
                      "pattern": "^[a-z][A-Za-z0-9]{0,20}$"
                    },
                    "in": {
                      "type": "array",
                      "minItems": 1,
                      "uniqueItems": true,
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "input",
                    "in"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "lookback"
          ],
          "additionalProperties": false
        }
      ],
      "default": {
        "lookback": 0
      }
    },
    "usesVolume": {
      "type": "boolean",
      "default": false
    },
    "inputs": {
      "type": "object",
      "maxProperties": 24,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,20}$"
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "integer"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "description": {
                "type": "string",
                "minLength": 0,
                "maxLength": 240
              },
              "default": {
                "type": "integer"
              },
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "step": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "type",
              "label",
              "default"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "number"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "description": {
                "type": "string",
                "minLength": 0,
                "maxLength": 240
              },
              "default": {
                "type": "number"
              },
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "step": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "type",
              "label",
              "default"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "boolean"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "description": {
                "type": "string",
                "minLength": 0,
                "maxLength": 240
              },
              "default": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "label",
              "default"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "select"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "description": {
                "type": "string",
                "minLength": 0,
                "maxLength": 240
              },
              "default": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "options": {
                "type": "array",
                "minItems": 1,
                "maxItems": 16,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                }
              }
            },
            "required": [
              "type",
              "label",
              "default",
              "options"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "source"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "description": {
                "type": "string",
                "minLength": 0,
                "maxLength": 240
              },
              "default": {
                "enum": [
                  "open",
                  "high",
                  "low",
                  "close",
                  "hlc3"
                ]
              }
            },
            "required": [
              "type",
              "label",
              "default"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "text"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "description": {
                "type": "string",
                "minLength": 0,
                "maxLength": 240
              },
              "default": {
                "type": "string",
                "minLength": 0,
                "maxLength": 64
              }
            },
            "required": [
              "type",
              "label",
              "default"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "time"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "description": {
                "type": "string",
                "minLength": 0,
                "maxLength": 240
              },
              "default": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4102444800,
                "description": "Unix seconds; 0 means not set"
              }
            },
            "required": [
              "type",
              "label",
              "default"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "plots": {
      "type": "object",
      "maxProperties": 16,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "lineWidth": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 8
          },
          "lineStyle": {
            "enum": [
              "solid",
              "dashed",
              "dotted"
            ]
          },
          "primary": {
            "type": "boolean"
          },
          "offset": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -500,
                "maximum": 500
              },
              {
                "type": "string",
                "pattern": "^(-?)([a-z][A-Za-z0-9]{0,20})(?:([+-])([1-9]\\d{0,2}))?$"
              }
            ]
          },
          "gaps": {
            "enum": [
              "bridge",
              "break"
            ]
          },
          "style": {
            "enum": [
              "line",
              "step",
              "circles",
              "cross",
              "area",
              "histogram"
            ],
            "description": "Schema v3"
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false
      }
    },
    "levels": {
      "type": "object",
      "maxProperties": 16,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "lineWidth": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 8
          },
          "lineStyle": {
            "enum": [
              "solid",
              "dashed",
              "dotted"
            ]
          },
          "showValue": {
            "type": "boolean"
          },
          "labelStyle": {
            "enum": [
              "axis",
              "inline"
            ],
            "description": "Schema v3; 'inline' (price pane only) draws the label on the line"
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false
      }
    },
    "zones": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "opacity": {
            "type": "number",
            "minimum": 0,
            "maximum": 0.8
          },
          "offset": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -500,
                "maximum": 500
              },
              {
                "type": "string",
                "pattern": "^(-?)([a-z][A-Za-z0-9]{0,20})(?:([+-])([1-9]\\d{0,2}))?$"
              }
            ]
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false
      }
    },
    "markers": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "radius": {
            "type": "number",
            "minimum": 2,
            "maximum": 8
          },
          "shape": {
            "enum": [
              "circle",
              "square",
              "diamond",
              "triangleUp",
              "triangleDown",
              "arrowUp",
              "arrowDown",
              "cross",
              "x",
              "flag",
              "char"
            ],
            "description": "Schema v3; 'char' draws char"
          },
          "char": {
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\p{P}\\p{S}]$",
            "description": "One visible character"
          },
          "size": {
            "enum": [
              "tiny",
              "small",
              "normal",
              "large"
            ]
          },
          "placement": {
            "enum": [
              "absolute",
              "aboveBar",
              "belowBar"
            ],
            "description": "'aboveBar'/'belowBar' (price pane only) sit the shape by the bar's high or low"
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          },
          "hideBelowBarWidth": {
            "type": "number",
            "minimum": 0,
            "maximum": 40,
            "description": "Pixels"
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false,
        "if": {
          "type": "object",
          "properties": {
            "shape": {
              "const": "char"
            }
          },
          "required": [
            "shape"
          ]
        },
        "then": {
          "type": "object",
          "properties": {
            "char": true
          },
          "required": [
            "char"
          ]
        },
        "else": {
          "type": "object",
          "not": {
            "type": "object",
            "properties": {
              "char": true
            },
            "required": [
              "char"
            ]
          }
        }
      }
    },
    "columns": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false
      }
    },
    "profiles": {
      "type": "object",
      "maxProperties": 4,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "upColor": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "opacity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "placement": {
            "enum": [
              "range",
              "visible"
            ]
          }
        },
        "required": [
          "label",
          "color",
          "placement"
        ],
        "additionalProperties": false
      }
    },
    "presets": {
      "type": "array",
      "maxItems": 8,
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 48,
            "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "shortName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "inputs": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "string"
                }
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "shortName",
          "inputs"
        ],
        "additionalProperties": false
      }
    },
    "docs": {
      "type": "object",
      "properties": {
        "overview": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        },
        "howToRead": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        },
        "settings": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        },
        "notes": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        }
      },
      "required": [
        "overview"
      ],
      "additionalProperties": false
    },
    "auxiliary": {
      "type": "object",
      "minProperties": 1,
      "maxProperties": 4,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "barSize": {
            "enum": [
              "1 min",
              "2 mins",
              "3 mins",
              "5 mins",
              "10 mins",
              "15 mins",
              "20 mins",
              "30 mins",
              "1 hour",
              "2 hours",
              "3 hours",
              "4 hours",
              "8 hours",
              "1 day",
              "1 week",
              "1 month",
              "chart"
            ],
            "description": "'chart': the chart's own bar size"
          },
          "duration": {
            "type": "string",
            "pattern": "^(?:(?:[1-9]|[1-9][0-9]|[1-2][0-9]{2}|3[0-5][0-9]|36[0-5]) D|(?:[1-9]|[1-4][0-9]|5[0-2]) W|(?:[1-9]|1[0-2]) M|[1-9][0-9]? Y)$",
            "description": "e.g. '2 Y'"
          },
          "useRth": {
            "type": "boolean",
            "default": true
          },
          "whatToShow": {
            "enum": [
              "TRADES",
              "MIDPOINT",
              "BID",
              "ASK",
              "BID_ASK"
            ],
            "description": "Default: the chart's own (usually TRADES)"
          },
          "keepUpToDate": {
            "type": "boolean",
            "default": false
          },
          "when": {
            "type": "object",
            "properties": {
              "all": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-z][A-Za-z0-9]{0,20}$"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "input": {
                          "type": "string",
                          "pattern": "^[a-z][A-Za-z0-9]{0,20}$"
                        },
                        "in": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 16,
                          "uniqueItems": true,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 32
                          }
                        }
                      },
                      "required": [
                        "input",
                        "in"
                      ],
                      "additionalProperties": false,
                      "description": "Holds while the select input has one of these options"
                    }
                  ]
                },
                "uniqueItems": true
              },
              "any": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-z][A-Za-z0-9]{0,20}$"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "input": {
                          "type": "string",
                          "pattern": "^[a-z][A-Za-z0-9]{0,20}$"
                        },
                        "in": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 16,
                          "uniqueItems": true,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 32
                          }
                        }
                      },
                      "required": [
                        "input",
                        "in"
                      ],
                      "additionalProperties": false,
                      "description": "Holds while the select input has one of these options"
                    }
                  ]
                },
                "uniqueItems": true
              }
            },
            "minProperties": 1,
            "additionalProperties": false
          }
        },
        "required": [
          "barSize",
          "duration"
        ],
        "additionalProperties": false
      }
    },
    "palettes": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "colors": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "type": "string",
              "pattern": "^#[0-9A-Fa-f]{6}$",
              "description": "#RRGGBB"
            }
          }
        },
        "required": [
          "label",
          "colors"
        ],
        "additionalProperties": false
      }
    },
    "tables": {
      "type": "object",
      "maxProperties": 4,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "position": {
            "enum": [
              "top-left",
              "top-center",
              "top-right",
              "middle-left",
              "middle-center",
              "middle-right",
              "bottom-left",
              "bottom-center",
              "bottom-right"
            ]
          },
          "columns": {
            "type": "array",
            "minItems": 1,
            "maxItems": 12,
            "items": {
              "type": "object",
              "properties": {
                "align": {
                  "enum": [
                    "left",
                    "center",
                    "right"
                  ]
                },
                "width": {
                  "type": "integer",
                  "minimum": 2,
                  "maximum": 32,
                  "description": "Characters"
                }
              },
              "additionalProperties": false
            }
          },
          "textSize": {
            "enum": [
              "small",
              "normal",
              "large"
            ]
          },
          "font": {
            "enum": [
              "mono",
              "sans"
            ]
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "textColor": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "opacity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "border": {
            "type": "boolean"
          },
          "offsetX": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200,
            "description": "Pixels"
          },
          "offsetY": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200,
            "description": "Pixels"
          }
        },
        "required": [
          "label",
          "position",
          "columns"
        ],
        "additionalProperties": false
      }
    },
    "labels": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "textColor": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "textSize": {
            "enum": [
              "small",
              "normal",
              "large"
            ]
          },
          "font": {
            "enum": [
              "mono",
              "sans"
            ]
          },
          "style": {
            "enum": [
              "none",
              "box",
              "pin",
              "arrow"
            ]
          },
          "placement": {
            "enum": [
              "above",
              "below",
              "left",
              "right",
              "center"
            ]
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          },
          "hideBelowBarWidth": {
            "type": "number",
            "minimum": 0,
            "maximum": 40,
            "description": "Pixels"
          },
          "maxVisible": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false
      }
    },
    "barColors": {
      "type": "object",
      "maxProperties": 2,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          }
        },
        "required": [
          "label",
          "palette"
        ],
        "additionalProperties": false
      }
    },
    "bgColors": {
      "type": "object",
      "maxProperties": 2,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          },
          "opacity": {
            "type": "number",
            "minimum": 0,
            "maximum": 0.6
          }
        },
        "required": [
          "label",
          "palette"
        ],
        "additionalProperties": false
      }
    },
    "segments": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "lineWidth": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 8
          },
          "lineStyle": {
            "enum": [
              "solid",
              "dashed",
              "dotted"
            ]
          },
          "extend": {
            "enum": [
              "none",
              "right",
              "left",
              "both"
            ]
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false
      }
    },
    "boxes": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "pattern": "^[a-z][A-Za-z0-9]{0,13}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "borderColor": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "#RRGGBB"
          },
          "opacity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "lineWidth": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 8
          },
          "textSize": {
            "enum": [
              "small",
              "normal",
              "large"
            ]
          },
          "extend": {
            "enum": [
              "none",
              "right"
            ]
          },
          "palette": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]{0,13}$",
            "description": "Key of a declared palette"
          },
          "hideBelowBarWidth": {
            "type": "number",
            "minimum": 0,
            "maximum": 40,
            "description": "Pixels"
          }
        },
        "required": [
          "label",
          "color"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "schemaVersion",
    "id",
    "name",
    "shortName",
    "version",
    "author",
    "description",
    "pane"
  ],
  "additionalProperties": false,
  "if": {
    "type": "object",
    "properties": {
      "schemaVersion": {
        "const": 1
      }
    }
  },
  "then": {
    "type": "object",
    "properties": {
      "auxiliary": false,
      "profiles": false
    }
  },
  "allOf": [
    {
      "if": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "enum": [
              1,
              2
            ]
          }
        }
      },
      "then": {
        "type": "object",
        "properties": {
          "palettes": false,
          "tables": false,
          "labels": false,
          "barColors": false,
          "bgColors": false,
          "segments": false,
          "boxes": false,
          "plots": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "style": false,
                "palette": false
              }
            }
          },
          "levels": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "labelStyle": false
              }
            }
          },
          "zones": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "palette": false
              }
            }
          },
          "markers": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "shape": false,
                "char": false,
                "size": false,
                "placement": false,
                "palette": false,
                "hideBelowBarWidth": false
              }
            }
          }
        }
      }
    }
  ]
}
