definitions.jsonschema 5.4 KB

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