board_viewer_data.schema.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. "ioEvidenceGrades": {
  98. "type": "object",
  99. "additionalProperties": false,
  100. "required": ["physical_path", "product_polarity", "hardware_measurement"],
  101. "properties": {
  102. "physical_path": {
  103. "enum": ["confirmed_by_brd", "inferred", "blocked", "not_applicable", "unknown"]
  104. },
  105. "product_polarity": {
  106. "enum": [
  107. "confirmed_by_electrical_staff",
  108. "inferred",
  109. "blocked",
  110. "not_applicable",
  111. "unknown"
  112. ]
  113. },
  114. "hardware_measurement": {
  115. "enum": ["not_run", "pass", "fail", "blocked", "not_applicable", "unknown"]
  116. }
  117. }
  118. },
  119. "fpga": {
  120. "type": "object",
  121. "additionalProperties": false,
  122. "required": ["ball", "board_signal", "io_standard", "capabilities", "evidence_tier", "sources"],
  123. "properties": {
  124. "ball": {"type": "string"},
  125. "board_signal": {"type": "string"},
  126. "io_standard": {"type": "string"},
  127. "capabilities": {"type": "array", "items": {"type": "string"}},
  128. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  129. "sources": {"type": "array", "items": {"type": "string"}}
  130. }
  131. },
  132. "mcu": {
  133. "type": "object",
  134. "additionalProperties": false,
  135. "required": ["device", "family", "pin", "signal", "capabilities", "evidence_tier", "sources"],
  136. "properties": {
  137. "device": {"type": "string", "minLength": 1},
  138. "family": {"type": "string", "minLength": 1},
  139. "pin": {"type": "string", "minLength": 1},
  140. "signal": {"type": "string", "minLength": 1},
  141. "capabilities": {"type": "array", "items": {"type": "string", "minLength": 1}},
  142. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  143. "sources": {"type": "array", "items": {"type": "string", "minLength": 1}}
  144. }
  145. },
  146. "pin": {
  147. "type": "object",
  148. "additionalProperties": false,
  149. "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"],
  150. "properties": {
  151. "id": {"type": "string", "minLength": 1},
  152. "number": {"type": "string"},
  153. "pad_role": {"enum": ["contact", "shield", "mechanical", "unknown"]},
  154. "row": {"type": ["integer", "null"], "minimum": 1},
  155. "column": {"type": ["integer", "null"], "minimum": 1},
  156. "board_order": {"type": ["integer", "null"], "minimum": 1},
  157. "mechanical": {"type": "boolean"},
  158. "electrical": {"type": "boolean"},
  159. "net": {"type": ["string", "null"]},
  160. "position": {"$ref": "#/$defs/point"},
  161. "view_position": {"$ref": "#/$defs/point"},
  162. "size": {
  163. "type": "object",
  164. "additionalProperties": false,
  165. "required": ["width", "height", "drill_width", "drill_height"],
  166. "properties": {
  167. "width": {"type": "number", "minimum": 0},
  168. "height": {"type": "number", "minimum": 0},
  169. "drill_width": {"type": "number", "minimum": 0},
  170. "drill_height": {"type": "number", "minimum": 0}
  171. }
  172. },
  173. "rotation": {"type": "number"},
  174. "shape": {"type": "string"},
  175. "layers": {"type": "array", "items": {"type": "string"}},
  176. "direction": {"enum": ["input", "output", "bidirectional", "passive", "unknown"]},
  177. "external_level": {"type": "string"},
  178. "function_category": {"type": "string"},
  179. "reserved": {"type": "boolean"},
  180. "fixed_load_conflict": {"type": "boolean"},
  181. "board_pull": {"type": ["string", "null"]},
  182. "adc_pulltype": {"type": ["string", "null"], "pattern": "^[A-Z][A-Z0-9_]*$"},
  183. "active_level": {"type": "string", "minLength": 1},
  184. "polarity": {"type": "string", "minLength": 1},
  185. "external_components": {"type": "array", "items": {"type": "string", "minLength": 1}},
  186. "summary": {"type": "string"},
  187. "path": {"type": "array", "items": {"type": "string"}},
  188. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  189. "evidence_sources": {"type": "array", "items": {"type": "string"}},
  190. "evidence_grades": {"$ref": "#/$defs/ioEvidenceGrades"},
  191. "fpga": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/fpga"}]},
  192. "mcu": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/mcu"}]},
  193. "programming": {"$ref": "#/$defs/programming"},
  194. "recommendation": {
  195. "type": "object",
  196. "additionalProperties": false,
  197. "required": ["eligible", "reasons"],
  198. "properties": {
  199. "eligible": {"type": "boolean"},
  200. "reasons": {"type": "array", "items": {"type": "string"}}
  201. }
  202. }
  203. }
  204. },
  205. "programming": {
  206. "type": "object",
  207. "additionalProperties": false,
  208. "required": ["status", "conclusion", "network_explanation", "hdl_guidance", "connection_guidance", "constraints", "risks", "evidence_tier", "sources"],
  209. "properties": {
  210. "status": {"enum": ["verified_fpga", "verified_mcu", "board_only", "not_programmable", "unknown"]},
  211. "conclusion": {"type": "string", "minLength": 1},
  212. "network_explanation": {"type": "string", "minLength": 1},
  213. "hdl_guidance": {"type": "string", "minLength": 1},
  214. "connection_guidance": {"type": "array", "items": {"type": "string", "minLength": 1}},
  215. "constraints": {"type": "array", "items": {"type": "string", "minLength": 1}},
  216. "risks": {"type": "array", "items": {"type": "string", "minLength": 1}},
  217. "evidence_tier": {"$ref": "#/$defs/evidenceTier"},
  218. "sources": {"type": "array", "items": {"type": "string", "minLength": 1}}
  219. }
  220. },
  221. "connector": {
  222. "type": "object",
  223. "additionalProperties": false,
  224. "required": ["profile", "review_status", "view", "contact_count", "auxiliary_pad_count", "rows", "columns", "contact_grid", "contact_order", "sources"],
  225. "properties": {
  226. "profile": {"type": ["string", "null"]},
  227. "review_status": {"$ref": "#/$defs/evidenceTier"},
  228. "view": {"const": "board_front"},
  229. "contact_count": {"type": "integer", "minimum": 0},
  230. "auxiliary_pad_count": {"type": "integer", "minimum": 0},
  231. "rows": {"type": "integer", "minimum": 0},
  232. "columns": {"type": "integer", "minimum": 0},
  233. "contact_grid": {
  234. "type": "array",
  235. "items": {"type": "array", "items": {"type": "string", "minLength": 1}}
  236. },
  237. "contact_order": {"type": "array", "items": {"type": "string", "minLength": 1}},
  238. "sources": {"type": "array", "items": {"type": "string", "minLength": 1}}
  239. }
  240. },
  241. "touchpoint": {
  242. "type": "object",
  243. "additionalProperties": false,
  244. "required": ["reference", "category", "component_value", "position", "view_position", "rotation", "bounds", "view_bounds", "side", "summary", "connector", "pins"],
  245. "properties": {
  246. "reference": {"type": "string", "pattern": "^(CON|J|PL|TP)[0-9]+$"},
  247. "category": {"enum": ["CON", "J", "PL", "TP"]},
  248. "component_value": {"type": "string"},
  249. "position": {"$ref": "#/$defs/point"},
  250. "view_position": {"$ref": "#/$defs/point"},
  251. "rotation": {"type": "number"},
  252. "bounds": {"$ref": "#/$defs/bounds"},
  253. "view_bounds": {"$ref": "#/$defs/bounds"},
  254. "side": {"enum": ["front", "back"]},
  255. "summary": {"type": "string"},
  256. "connector": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/connector"}]},
  257. "pins": {"type": "array", "items": {"$ref": "#/$defs/pin"}}
  258. }
  259. }
  260. }
  261. }