definitions.jsonschema 4.4 KB

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