|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "https://spreadsheet.dsl.builders/schema/query.schema.json", |
| 4 | + "title": "Spreadsheet Builder CLI Query Criteria", |
| 5 | + "description": "Serialized criteria tree accepted by `spreadsheet-builder-cli query`. The same shape can be written as JSON or YAML.", |
| 6 | + "$ref": "#/$defs/workbookCriterion", |
| 7 | + "$defs": { |
| 8 | + "oneOrManySheets": { |
| 9 | + "oneOf": [ |
| 10 | + { "$ref": "#/$defs/sheetCriterion" }, |
| 11 | + { |
| 12 | + "type": "array", |
| 13 | + "items": { "$ref": "#/$defs/sheetCriterion" } |
| 14 | + } |
| 15 | + ] |
| 16 | + }, |
| 17 | + "oneOrManyRows": { |
| 18 | + "oneOf": [ |
| 19 | + { "$ref": "#/$defs/rowCriterion" }, |
| 20 | + { |
| 21 | + "type": "array", |
| 22 | + "items": { "$ref": "#/$defs/rowCriterion" } |
| 23 | + } |
| 24 | + ] |
| 25 | + }, |
| 26 | + "oneOrManyCells": { |
| 27 | + "oneOf": [ |
| 28 | + { "$ref": "#/$defs/cellCriterion" }, |
| 29 | + { |
| 30 | + "type": "array", |
| 31 | + "items": { "$ref": "#/$defs/cellCriterion" } |
| 32 | + } |
| 33 | + ] |
| 34 | + }, |
| 35 | + "oneOrManyWorkbookAlternatives": { |
| 36 | + "oneOf": [ |
| 37 | + { "$ref": "#/$defs/workbookCriterion" }, |
| 38 | + { |
| 39 | + "type": "array", |
| 40 | + "items": { "$ref": "#/$defs/workbookCriterion" } |
| 41 | + } |
| 42 | + ] |
| 43 | + }, |
| 44 | + "oneOrManySheetAlternatives": { |
| 45 | + "oneOf": [ |
| 46 | + { "$ref": "#/$defs/sheetCriterion" }, |
| 47 | + { |
| 48 | + "type": "array", |
| 49 | + "items": { "$ref": "#/$defs/sheetCriterion" } |
| 50 | + } |
| 51 | + ] |
| 52 | + }, |
| 53 | + "oneOrManyRowAlternatives": { |
| 54 | + "oneOf": [ |
| 55 | + { "$ref": "#/$defs/rowCriterion" }, |
| 56 | + { |
| 57 | + "type": "array", |
| 58 | + "items": { "$ref": "#/$defs/rowCriterion" } |
| 59 | + } |
| 60 | + ] |
| 61 | + }, |
| 62 | + "oneOrManyCellAlternatives": { |
| 63 | + "oneOf": [ |
| 64 | + { "$ref": "#/$defs/cellCriterion" }, |
| 65 | + { |
| 66 | + "type": "array", |
| 67 | + "items": { "$ref": "#/$defs/cellCriterion" } |
| 68 | + } |
| 69 | + ] |
| 70 | + }, |
| 71 | + "cellAddress": { |
| 72 | + "description": "Excel column name such as A/C/AA, or a one-based numeric column index.", |
| 73 | + "oneOf": [ |
| 74 | + { "type": "integer", "minimum": 1 }, |
| 75 | + { "type": "string", "pattern": "^[A-Za-z]+$" } |
| 76 | + ] |
| 77 | + }, |
| 78 | + "workbookCriterion": { |
| 79 | + "type": "object", |
| 80 | + "additionalProperties": false, |
| 81 | + "properties": { |
| 82 | + "sheets": { "$ref": "#/$defs/oneOrManySheets" }, |
| 83 | + "sheet": { |
| 84 | + "type": "string", |
| 85 | + "description": "Shortcut for selecting a sheet by name when sheet criteria live at the root." |
| 86 | + }, |
| 87 | + "or": { "$ref": "#/$defs/oneOrManyWorkbookAlternatives" } |
| 88 | + }, |
| 89 | + "anyOf": [ |
| 90 | + { "required": ["sheets"] }, |
| 91 | + { "required": ["sheet"] }, |
| 92 | + { "required": ["or"] } |
| 93 | + ] |
| 94 | + }, |
| 95 | + "sheetCriterion": { |
| 96 | + "type": "object", |
| 97 | + "additionalProperties": false, |
| 98 | + "properties": { |
| 99 | + "name": { "type": "string" }, |
| 100 | + "state": { |
| 101 | + "type": "string", |
| 102 | + "description": "Sheet state. Case-insensitive in the CLI; hyphens are treated as underscores.", |
| 103 | + "examples": ["visible", "hidden", "very-hidden", "locked"] |
| 104 | + }, |
| 105 | + "page": { "$ref": "#/$defs/pageCriterion" }, |
| 106 | + "rows": { "$ref": "#/$defs/oneOrManyRows" }, |
| 107 | + "or": { "$ref": "#/$defs/oneOrManySheetAlternatives" } |
| 108 | + } |
| 109 | + }, |
| 110 | + "pageCriterion": { |
| 111 | + "type": "object", |
| 112 | + "additionalProperties": false, |
| 113 | + "properties": { |
| 114 | + "orientation": { |
| 115 | + "type": "string", |
| 116 | + "description": "Page orientation. Case-insensitive in the CLI.", |
| 117 | + "examples": ["landscape", "portrait"] |
| 118 | + }, |
| 119 | + "paper": { |
| 120 | + "type": "string", |
| 121 | + "description": "Paper name. Case-insensitive in the CLI; hyphens are treated as underscores.", |
| 122 | + "examples": ["A4", "letter", "legal", "standard-11-17"] |
| 123 | + } |
| 124 | + } |
| 125 | + }, |
| 126 | + "rowCriterion": { |
| 127 | + "type": "object", |
| 128 | + "additionalProperties": false, |
| 129 | + "properties": { |
| 130 | + "from": { "type": "integer", "minimum": 1 }, |
| 131 | + "to": { "type": "integer", "minimum": 1 }, |
| 132 | + "number": { "type": "integer", "minimum": 1 }, |
| 133 | + "row": { "type": "integer", "minimum": 1 }, |
| 134 | + "cells": { "$ref": "#/$defs/oneOrManyCells" }, |
| 135 | + "or": { "$ref": "#/$defs/oneOrManyRowAlternatives" } |
| 136 | + } |
| 137 | + }, |
| 138 | + "cellCriterion": { |
| 139 | + "type": "object", |
| 140 | + "additionalProperties": false, |
| 141 | + "properties": { |
| 142 | + "from": { "$ref": "#/$defs/cellAddress" }, |
| 143 | + "to": { "$ref": "#/$defs/cellAddress" }, |
| 144 | + "column": { "$ref": "#/$defs/cellAddress" }, |
| 145 | + "value": { |
| 146 | + "description": "Exact cell value to match.", |
| 147 | + "type": ["string", "number", "integer", "boolean", "null"] |
| 148 | + }, |
| 149 | + "string": { "type": "string" }, |
| 150 | + "number": { "type": "number" }, |
| 151 | + "bool": { |
| 152 | + "oneOf": [ |
| 153 | + { "type": "boolean" }, |
| 154 | + { "type": "string", "enum": ["true", "false"] } |
| 155 | + ] |
| 156 | + }, |
| 157 | + "localDate": { "type": "string", "format": "date" }, |
| 158 | + "localDateTime": { |
| 159 | + "type": "string", |
| 160 | + "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\\.[0-9]+)?)?$" |
| 161 | + }, |
| 162 | + "localTime": { |
| 163 | + "type": "string", |
| 164 | + "pattern": "^[0-9]{2}:[0-9]{2}(:[0-9]{2}(\\.[0-9]+)?)?$" |
| 165 | + }, |
| 166 | + "rowspan": { "type": "integer", "minimum": 1 }, |
| 167 | + "colspan": { "type": "integer", "minimum": 1 }, |
| 168 | + "name": { "type": "string" }, |
| 169 | + "comment": { "type": "string" }, |
| 170 | + "style": { "$ref": "#/$defs/styleCriterion" }, |
| 171 | + "or": { "$ref": "#/$defs/oneOrManyCellAlternatives" } |
| 172 | + } |
| 173 | + }, |
| 174 | + "styleCriterion": { |
| 175 | + "type": "object", |
| 176 | + "additionalProperties": false, |
| 177 | + "properties": { |
| 178 | + "background": { "type": "string" }, |
| 179 | + "foreground": { "type": "string" }, |
| 180 | + "fill": { |
| 181 | + "type": "string", |
| 182 | + "description": "Foreground fill. Case-insensitive in the CLI; hyphens are treated as underscores.", |
| 183 | + "examples": ["solid-foreground", "fine-dots", "no-fill"] |
| 184 | + }, |
| 185 | + "indent": { "type": "integer", "minimum": 0 }, |
| 186 | + "rotation": { "type": "integer" }, |
| 187 | + "format": { "type": "string" } |
| 188 | + } |
| 189 | + } |
| 190 | + } |
| 191 | +} |
0 commit comments