definitions.jsonschema 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. "filename": {
  26. "type": "string",
  27. "minLength": 1,
  28. "pattern": "^[0-9a-z_]*$"
  29. },
  30. "hex_number_2d": {
  31. "type": "string",
  32. "pattern": "^0x[0-9A-F]{2}$"
  33. },
  34. "hex_number_4d": {
  35. "type": "string",
  36. "pattern": "^0x[0-9A-F]{4}$"
  37. },
  38. "json_file_path": {
  39. "type": "string",
  40. "pattern": "^[0-9a-z_/\\-]+\\.json$"
  41. },
  42. "key_unit": {
  43. "type": "number",
  44. "minimum": 0
  45. },
  46. "keyboard": {
  47. "type": "string",
  48. "pattern": "^[0-9a-z][0-9a-z_/]*$"
  49. },
  50. "keyboard_keymap_tuple": {
  51. "type": "array",
  52. "prefixItems": [
  53. {"$ref": "#/keyboard"},
  54. {"$ref": "#/filename"}
  55. ],
  56. "unevaluatedItems": false
  57. },
  58. "keycode": {
  59. "type": "string",
  60. "minLength": 2,
  61. "maxLength": 50,
  62. "pattern": "^[A-Z][A-Zs_0-9]*$"
  63. },
  64. "keycode_decl": {
  65. "type": "object",
  66. "required": [
  67. "key"
  68. ],
  69. "properties": {
  70. "key": {"$ref": "#/keycode"},
  71. "label": {"$ref": "#/text_identifier"},
  72. "aliases": {
  73. "type": "array",
  74. "minItems": 1,
  75. "items": {"$ref": "#/keycode_short"}
  76. }
  77. }
  78. },
  79. "keycode_decl_array": {
  80. "type": "array",
  81. "minItems": 1,
  82. "items": {"$ref": "#/keycode_decl"}
  83. },
  84. "keycode_short": {
  85. "type": "string",
  86. "minLength": 2,
  87. "maxLength": 7,
  88. "pattern": "^[A-Z][A-Zs_0-9]*$"
  89. },
  90. "layout_macro": {
  91. "oneOf": [
  92. {
  93. "type": "string",
  94. "enum": [
  95. "LAYOUT",
  96. "LAYOUT_1x2uC",
  97. "LAYOUT_1x2uL",
  98. "LAYOUT_1x2uR",
  99. "LAYOUT_2x2uC",
  100. "LAYOUT_2x3uC",
  101. "LAYOUT_625uC",
  102. "LAYOUT_ortho_3x12_1x2uC",
  103. "LAYOUT_ortho_4x12_1x2uC",
  104. "LAYOUT_ortho_4x12_1x2uL",
  105. "LAYOUT_ortho_4x12_1x2uR",
  106. "LAYOUT_ortho_5x12_1x2uC",
  107. "LAYOUT_ortho_5x12_2x2uC",
  108. "LAYOUT_ortho_5x14_1x2uC",
  109. "LAYOUT_ortho_5x14_1x2uL",
  110. "LAYOUT_ortho_5x14_1x2uR",
  111. "LAYOUT_planck_1x2uC",
  112. "LAYOUT_planck_1x2uL",
  113. "LAYOUT_planck_1x2uR",
  114. "LAYOUT_preonic_1x2uC",
  115. "LAYOUT_preonic_1x2uL",
  116. "LAYOUT_preonic_1x2uR"
  117. ]
  118. },
  119. {
  120. "type": "string",
  121. "pattern": "^LAYOUT_[0-9a-z_]*$"
  122. }
  123. ]
  124. },
  125. "mcu_pin": {
  126. "oneOf": [
  127. {
  128. "type": "string",
  129. "enum": ["NO_PIN"]
  130. },
  131. {
  132. "type": "string",
  133. "pattern": "^[A-K]\\d{1,2}$"
  134. },
  135. {
  136. "type": "string",
  137. "pattern": "^LINE_PIN\\d{1,2}$"
  138. },
  139. {
  140. "type": "string",
  141. "pattern": "^GP\\d{1,2}$"
  142. },
  143. {"type": "integer"},
  144. {"type": "null"}
  145. ]
  146. },
  147. "mcu_pin_array": {
  148. "type": "array",
  149. "items": {"$ref": "#/mcu_pin"}
  150. },
  151. "signed_decimal": {
  152. "type": "number"
  153. },
  154. "signed_int": {
  155. "type": "integer"
  156. },
  157. "signed_int_8": {
  158. "type": "integer",
  159. "minimum": -127,
  160. "maximum": 127
  161. },
  162. "snake_case": {
  163. "type": "string",
  164. "pattern": "^[a-z][a-z0-9_]*$"
  165. },
  166. "string_array": {
  167. "type": "array",
  168. "items": {"type": "string"}
  169. },
  170. "string_object": {
  171. "type": "object",
  172. "additionalProperties": {"type": "string"}
  173. },
  174. "text_identifier": {
  175. "type": "string",
  176. "minLength": 1,
  177. "maxLength": 250
  178. },
  179. "unsigned_decimal": {
  180. "type": "number",
  181. "minimum": 0
  182. },
  183. "unsigned_int": {
  184. "type": "integer",
  185. "minimum": 0
  186. },
  187. "unsigned_int_8": {
  188. "type": "integer",
  189. "minimum": 0,
  190. "maximum": 255
  191. }
  192. }