summaryrefslogtreecommitdiffstats
path: root/data/schemas/definitions.jsonschema
blob: 441e6395cf6ef69616660b200594ad97f6ccadb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{
    "$schema": "https://json-schema.org/draft/2020-12/schema#",
    "$id": "qmk.definitions.v1",
    "title": "Common definitions used across QMK's jsonschemas.",
    "type": "object",
    "boolean_array": {
        "type": "object",
        "additionalProperties": {"type": "boolean"}
    },
    "filename": {
        "type": "string",
        "minLength": 1,
        "pattern": "^[0-9a-z_]*$"
    },
    "hex_number_2d": {
        "type": "string",
        "pattern": "^0x[0-9A-F]{2}$"
    },
    "hex_number_4d": {
        "type": "string",
        "pattern": "^0x[0-9A-F]{4}$"
    },
    "bcd_version": {
        "type": "string",
        "pattern": "^[0-9]{1,2}\\.[0-9]\\.[0-9]$"
    },
    "text_identifier": {
        "type": "string",
        "minLength": 1,
        "maxLength": 250
    },
    "snake_case": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_]*$"
    },
    "layout_macro": {
        "oneOf": [
            {
                "type": "string",
                "enum": [
                    "LAYOUT",
                    "LAYOUT_1x2uC",
                    "LAYOUT_1x2uL",
                    "LAYOUT_1x2uR",
                    "LAYOUT_2x2uC",
                    "LAYOUT_2x3uC",
                    "LAYOUT_625uC",
                    "LAYOUT_ortho_3x12_1x2uC",
                    "LAYOUT_ortho_4x12_1x2uC",
                    "LAYOUT_ortho_4x12_1x2uL",
                    "LAYOUT_ortho_4x12_1x2uR",
                    "LAYOUT_ortho_5x12_1x2uC",
                    "LAYOUT_ortho_5x12_2x2uC",
                    "LAYOUT_ortho_5x14_1x2uC",
                    "LAYOUT_ortho_5x14_1x2uL",
                    "LAYOUT_ortho_5x14_1x2uR",
                    "LAYOUT_planck_1x2uC",
                    "LAYOUT_planck_1x2uL",
                    "LAYOUT_planck_1x2uR",
                    "LAYOUT_preonic_1x2uC",
                    "LAYOUT_preonic_1x2uL",
                    "LAYOUT_preonic_1x2uR"
                ]
            },
            {
                "type": "string",
                "pattern": "^LAYOUT_[0-9a-z_]*$"
            }
        ]
    },
    "key_unit": {
        "type": "number"
    },
    "keyboard": {
        "type": "string",
        "pattern": "^[0-9a-z][0-9a-z_/]*$"
    },
    "keycode": {
        "type": "string",
        "minLength": 2,
        "maxLength": 50,
        "pattern": "^[A-Z][A-Zs_0-9]*$"
    },
    "keycode_short": {
        "type": "string",
        "minLength": 2,
        "maxLength": 7,
        "pattern": "^[A-Z][A-Zs_0-9]*$"
    },
    "keycode_decl": {
        "type": "object",
        "required": [
            "key"
        ],
        "properties": {
            "key": {"$ref": "#/keycode"},
            "label": {"$ref": "#/text_identifier"},
            "aliases": {
                "type": "array",
                "minItems": 1,
                "items": {"$ref": "#/keycode_short"}
            }
        }
    },
    "keycode_decl_array": {
        "type": "array",
        "minItems": 1
        "items": {"$ref": "#/keycode_decl"}
    },
    "mcu_pin_array": {
        "type": "array",
        "items": {"$ref": "#/mcu_pin"}
    },
    "mcu_pin": {
        "oneOf": [
            {
                "type": "string",
                "enum": ["NO_PIN"]
            },
            {
                "type": "string",
                "pattern": "^[A-K]\\d{1,2}$"
            },
            {
                "type": "string",
                "pattern": "^LINE_PIN\\d{1,2}$"
            },
            {
                "type": "string",
                "pattern": "^GP\\d{1,2}$"
            },
            {
                "type": "integer"
            },
            {
                "type": "null"
            }
        ]
    },
    "signed_decimal": {
        "type": "number"
    },
    "signed_int": {
        "type": "integer"
    },
    "signed_int_8": {
        "type": "integer",
        "minimum": -127,
        "maximum": 127
    },
    "string_array": {
        "type": "array",
        "items": {
            "type": "string"
        }
    },
    "string_object": {
        "type": "object",
        "additionalProperties": {
            "type": "string"
        }
    },
    "unsigned_decimal": {
        "type": "number",
        "minimum": 0
    },
    "unsigned_int": {
        "type": "integer",
        "minimum": 0
    },
    "unsigned_int_8": {
        "type": "integer",
        "minimum": 0,
        "maximum": 255
    },
    "bit": {
        "type": "integer",
        "minimum": 0,
        "maximum": 1
    }
}