board_viewer_data.schema.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. {
  2. "$schema": "https://json-schema.org/draft/2020-12/schema",
  3. "$id": "https://local.invalid/schemas/board_viewer_data.schema.json",
  4. "title": "Generated board viewer data",
  5. "type": "object",
  6. "additionalProperties": false,
  7. "required": ["schema", "board", "counts", "touchpoints", "interfaces", "photo_overlay"],
  8. "properties": {
  9. "schema": {"const": "board-viewer-data-v1"},
  10. "board": {
  11. "type": "object",
  12. "additionalProperties": false,
  13. "required": ["id", "name", "source_bounds", "view_box"],
  14. "properties": {
  15. "id": {"type": "string", "minLength": 1},
  16. "name": {"type": "string", "minLength": 1},
  17. "source_bounds": {"$ref": "#/$defs/bounds"},
  18. "view_box": {"$ref": "#/$defs/bounds"}
  19. }
  20. },
  21. "counts": {
  22. "type": "object",
  23. "additionalProperties": false,
  24. "required": ["footprints", "touchpoints", "pads", "connector_contacts", "connector_auxiliary_pads", "categories", "sides"],
  25. "properties": {
  26. "footprints": {"type": "integer", "minimum": 0},
  27. "touchpoints": {"type": "integer", "minimum": 0},
  28. "pads": {"type": "integer", "minimum": 0},
  29. "connector_contacts": {"type": "integer", "minimum": 0},
  30. "connector_auxiliary_pads": {"type": "integer", "minimum": 0},
  31. "categories": {"$ref": "#/$defs/countMap"},
  32. "sides": {
  33. "type": "object",
  34. "additionalProperties": false,
  35. "required": ["front", "back"],
  36. "properties": {
  37. "front": {"type": "integer", "minimum": 0},
  38. "back": {"type": "integer", "minimum": 0}
  39. }
  40. }
  41. }
  42. },
  43. "touchpoints": {"type": "array", "items": {"$ref": "#/$defs/touchpoint"}},
  44. "interfaces": {"type": "array", "items": {"type": "object"}},
  45. "photo_overlay": {
  46. "oneOf": [
  47. {"type": "null"},
  48. {
  49. "type": "object",
  50. "additionalProperties": false,
  51. "required": ["asset", "sha256", "matrix", "control_point_count"],
  52. "properties": {
  53. "asset": {"type": "string", "pattern": "^board-photo\\.(png|jpg|jpeg|webp)$"},
  54. "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
  55. "matrix": {
  56. "type": "array",
  57. "minItems": 6,
  58. "maxItems": 6,
  59. "items": {"type": "number"}
  60. },
  61. "control_point_count": {"type": "integer", "minimum": 3}
  62. }
  63. }
  64. ]
  65. }
  66. },
  67. "$defs": {
  68. "countMap": {
  69. "type": "object",
  70. "additionalProperties": false,
  71. "required": ["CON", "J", "PL", "TP"],
  72. "properties": {
  73. "CON": {"type": "integer", "minimum": 0},
  74. "J": {"type": "integer", "minimum": 0},
  75. "PL": {"type": "integer", "minimum": 0},
  76. "TP": {"type": "integer", "minimum": 0}
  77. }
  78. },
  79. "point": {
  80. "type": "object",
  81. "additionalProperties": false,
  82. "required": ["x", "y"],
  83. "properties": {"x": {"type": "number"}, "y": {"type": "number"}}
  84. },
  85. "bounds": {
  86. "type": "object",
  87. "additionalProperties": false,
  88. "required": ["x", "y", "width", "height"],
  89. "properties": {
  90. "x": {"type": "number"},
  91. "y": {"type": "number"},
  92. "width": {"type": "number", "minimum": 0},
  93. "height": {"type": "number", "minimum": 0}
  94. }
  95. },
  96. "evidenceTier": {"enum": ["board_database", "cross_verified", "name_inferred", "unknown"]},
  97. "fpga": {
  98. "type": "object",
  99. "additionalProperties": false,
  100. "required": ["ball", "board_signal", "io_standard", "capabilities", "evidence_tier", "sources"],
  101. "properties": {
  102. "ball": {"type": "string"},
  103. "board_signal": {"type": "string"},
  104. "io_standard": {"type": "string"},
  105. "capabilities": {"type": "array", "items": {"type": "string"}},
  106. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  107. "sources": {"type": "array", "items": {"type": "string"}}
  108. }
  109. },
  110. "mcu": {
  111. "type": "object",
  112. "additionalProperties": false,
  113. "required": ["device", "family", "pin", "signal", "capabilities", "evidence_tier", "sources"],
  114. "properties": {
  115. "device": {"type": "string", "minLength": 1},
  116. "family": {"type": "string", "minLength": 1},
  117. "pin": {"type": "string", "minLength": 1},
  118. "signal": {"type": "string", "minLength": 1},
  119. "capabilities": {"type": "array", "items": {"type": "string", "minLength": 1}},
  120. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  121. "sources": {"type": "array", "items": {"type": "string", "minLength": 1}}
  122. }
  123. },
  124. "pin": {
  125. "type": "object",
  126. "additionalProperties": false,
  127. "required": ["id", "number", "pad_role", "row", "column", "board_order", "mechanical", "electrical", "net", "position", "view_position", "size", "rotation", "shape", "layers", "direction", "external_level", "function_category", "reserved", "fixed_load_conflict", "board_pull", "adc_pulltype", "active_level", "polarity", "external_components", "summary", "path", "evidence_tier", "evidence_sources", "fpga", "mcu", "programming", "recommendation"],
  128. "properties": {
  129. "id": {"type": "string", "minLength": 1},
  130. "number": {"type": "string"},
  131. "pad_role": {"enum": ["contact", "shield", "mechanical", "unknown"]},
  132. "row": {"type": ["integer", "null"], "minimum": 1},
  133. "column": {"type": ["integer", "null"], "minimum": 1},
  134. "board_order": {"type": ["integer", "null"], "minimum": 1},
  135. "mechanical": {"type": "boolean"},
  136. "electrical": {"type": "boolean"},
  137. "net": {"type": ["string", "null"]},
  138. "position": {"$ref": "#/$defs/point"},
  139. "view_position": {"$ref": "#/$defs/point"},
  140. "size": {
  141. "type": "object",
  142. "additionalProperties": false,
  143. "required": ["width", "height", "drill_width", "drill_height"],
  144. "properties": {
  145. "width": {"type": "number", "minimum": 0},
  146. "height": {"type": "number", "minimum": 0},
  147. "drill_width": {"type": "number", "minimum": 0},
  148. "drill_height": {"type": "number", "minimum": 0}
  149. }
  150. },
  151. "rotation": {"type": "number"},
  152. "shape": {"type": "string"},
  153. "layers": {"type": "array", "items": {"type": "string"}},
  154. "direction": {"enum": ["input", "output", "bidirectional", "passive", "unknown"]},
  155. "external_level": {"type": "string"},
  156. "function_category": {"type": "string"},
  157. "reserved": {"type": "boolean"},
  158. "fixed_load_conflict": {"type": "boolean"},
  159. "board_pull": {"type": ["string", "null"]},
  160. "adc_pulltype": {"type": ["string", "null"], "pattern": "^[A-Z][A-Z0-9_]*$"},
  161. "active_level": {"type": "string", "minLength": 1},
  162. "polarity": {"type": "string", "minLength": 1},
  163. "external_components": {"type": "array", "items": {"type": "string", "minLength": 1}},
  164. "summary": {"type": "string"},
  165. "path": {"type": "array", "items": {"type": "string"}},
  166. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  167. "evidence_sources": {"type": "array", "items": {"type": "string"}},
  168. "fpga": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/fpga"}]},
  169. "mcu": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/mcu"}]},
  170. "programming": {"$ref": "#/$defs/programming"},
  171. "recommendation": {
  172. "type": "object",
  173. "additionalProperties": false,
  174. "required": ["eligible", "reasons"],
  175. "properties": {
  176. "eligible": {"type": "boolean"},
  177. "reasons": {"type": "array", "items": {"type": "string"}}
  178. }
  179. }
  180. }
  181. },
  182. "programming": {
  183. "type": "object",
  184. "additionalProperties": false,
  185. "required": ["status", "conclusion", "network_explanation", "hdl_guidance", "connection_guidance", "constraints", "risks", "evidence_tier", "sources"],
  186. "properties": {
  187. "status": {"enum": ["verified_fpga", "verified_mcu", "board_only", "not_programmable", "unknown"]},
  188. "conclusion": {"type": "string", "minLength": 1},
  189. "network_explanation": {"type": "string", "minLength": 1},
  190. "hdl_guidance": {"type": "string", "minLength": 1},
  191. "connection_guidance": {"type": "array", "items": {"type": "string", "minLength": 1}},
  192. "constraints": {"type": "array", "items": {"type": "string", "minLength": 1}},
  193. "risks": {"type": "array", "items": {"type": "string", "minLength": 1}},
  194. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  195. "sources": {"type": "array", "items": {"type": "string", "minLength": 1}}
  196. }
  197. },
  198. "connector": {
  199. "type": "object",
  200. "additionalProperties": false,
  201. "required": ["profile", "review_status", "view", "contact_count", "auxiliary_pad_count", "rows", "columns", "contact_grid", "contact_order", "sources"],
  202. "properties": {
  203. "profile": {"type": ["string", "null"]},
  204. "review_status": {"$ref": "#/$defs/evidenceTier"},
  205. "view": {"const": "board_front"},
  206. "contact_count": {"type": "integer", "minimum": 0},
  207. "auxiliary_pad_count": {"type": "integer", "minimum": 0},
  208. "rows": {"type": "integer", "minimum": 0},
  209. "columns": {"type": "integer", "minimum": 0},
  210. "contact_grid": {
  211. "type": "array",
  212. "items": {"type": "array", "items": {"type": "string", "minLength": 1}}
  213. },
  214. "contact_order": {"type": "array", "items": {"type": "string", "minLength": 1}},
  215. "sources": {"type": "array", "items": {"type": "string", "minLength": 1}}
  216. }
  217. },
  218. "touchpoint": {
  219. "type": "object",
  220. "additionalProperties": false,
  221. "required": ["reference", "category", "component_value", "position", "view_position", "rotation", "bounds", "view_bounds", "side", "summary", "connector", "pins"],
  222. "properties": {
  223. "reference": {"type": "string", "pattern": "^(CON|J|PL|TP)[0-9]+$"},
  224. "category": {"enum": ["CON", "J", "PL", "TP"]},
  225. "component_value": {"type": "string"},
  226. "position": {"$ref": "#/$defs/point"},
  227. "view_position": {"$ref": "#/$defs/point"},
  228. "rotation": {"type": "number"},
  229. "bounds": {"$ref": "#/$defs/bounds"},
  230. "view_bounds": {"$ref": "#/$defs/bounds"},
  231. "side": {"enum": ["front", "back"]},
  232. "summary": {"type": "string"},
  233. "connector": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/connector"}]},
  234. "pins": {"type": "array", "items": {"$ref": "#/$defs/pin"}}
  235. }
  236. }
  237. }
  238. }