@documentation-robotics/cli 0.1.13 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/README.md +74 -2
  2. package/dist/analysis/relationship-classifier.js +2 -9
  3. package/dist/analysis/relationship-classifier.js.map +2 -2
  4. package/dist/analyzers/call-graph-utils.js +2 -2
  5. package/dist/analyzers/call-graph-utils.js.map +2 -2
  6. package/dist/analyzers/cards/build.js +171 -0
  7. package/dist/analyzers/cards/build.js.map +7 -0
  8. package/dist/analyzers/cards/classify.js +42 -0
  9. package/dist/analyzers/cards/classify.js.map +7 -0
  10. package/dist/analyzers/cards/edge-index.js +44 -0
  11. package/dist/analyzers/cards/edge-index.js.map +7 -0
  12. package/dist/analyzers/cards/facts.js +46 -0
  13. package/dist/analyzers/cards/facts.js.map +7 -0
  14. package/dist/analyzers/cards/graph.js +42 -0
  15. package/dist/analyzers/cards/graph.js.map +7 -0
  16. package/dist/analyzers/cards/index.js +8 -0
  17. package/dist/analyzers/cards/index.js.map +7 -0
  18. package/dist/analyzers/cards/tier0.js +18 -0
  19. package/dist/analyzers/cards/tier0.js.map +7 -0
  20. package/dist/analyzers/cards/types.js +1 -0
  21. package/dist/analyzers/cards/types.js.map +7 -0
  22. package/dist/analyzers/cbm-analyzer.js +195 -171
  23. package/dist/analyzers/cbm-analyzer.js.map +2 -2
  24. package/dist/analyzers/cbm-responses.js +336 -0
  25. package/dist/analyzers/cbm-responses.js.map +7 -0
  26. package/dist/analyzers/edge-relationships.js +45 -0
  27. package/dist/analyzers/edge-relationships.js.map +7 -0
  28. package/dist/analyzers/mapping-loader.js +9 -0
  29. package/dist/analyzers/mapping-loader.js.map +2 -2
  30. package/dist/analyzers/tier0-rules.js +153 -0
  31. package/dist/analyzers/tier0-rules.js.map +7 -0
  32. package/dist/analyzers/types.js.map +1 -1
  33. package/dist/analyzers/verify-engine.js +22 -19
  34. package/dist/analyzers/verify-engine.js.map +2 -2
  35. package/dist/audit/relationships/ai/prompts.js +10 -10
  36. package/dist/audit/relationships/ai/prompts.js.map +2 -2
  37. package/dist/audit/relationships/analysis/layer-templates.js +52 -52
  38. package/dist/audit/relationships/analysis/layer-templates.js.map +1 -1
  39. package/dist/cli.js +112 -28
  40. package/dist/cli.js.map +3 -3
  41. package/dist/coding-agents/agents/claude-code.js +3 -1
  42. package/dist/coding-agents/agents/claude-code.js.map +2 -2
  43. package/dist/coding-agents/claude-code-client.js +2 -1
  44. package/dist/coding-agents/claude-code-client.js.map +2 -2
  45. package/dist/coding-agents/copilot-client.js +17 -12
  46. package/dist/coding-agents/copilot-client.js.map +2 -2
  47. package/dist/coding-agents/default-permissions.js +152 -0
  48. package/dist/coding-agents/default-permissions.js.map +7 -0
  49. package/dist/coding-agents/drbot-mcp.js +167 -0
  50. package/dist/coding-agents/drbot-mcp.js.map +7 -0
  51. package/dist/commands/add.js +12 -7
  52. package/dist/commands/add.js.map +2 -2
  53. package/dist/commands/analyzer.js +134 -23
  54. package/dist/commands/analyzer.js.map +2 -2
  55. package/dist/commands/audit.js +6 -6
  56. package/dist/commands/audit.js.map +2 -2
  57. package/dist/commands/changeset-verify.js +55 -0
  58. package/dist/commands/changeset-verify.js.map +7 -0
  59. package/dist/commands/changeset.js +261 -147
  60. package/dist/commands/changeset.js.map +2 -2
  61. package/dist/commands/delete.js +52 -19
  62. package/dist/commands/delete.js.map +3 -3
  63. package/dist/commands/element.js +3 -2
  64. package/dist/commands/element.js.map +2 -2
  65. package/dist/commands/farm.js +773 -0
  66. package/dist/commands/farm.js.map +7 -0
  67. package/dist/commands/init.js +11 -1
  68. package/dist/commands/init.js.map +2 -2
  69. package/dist/commands/mcp.js +122 -0
  70. package/dist/commands/mcp.js.map +7 -0
  71. package/dist/commands/relationship.js +251 -47
  72. package/dist/commands/relationship.js.map +2 -2
  73. package/dist/commands/reports.js +1 -1
  74. package/dist/commands/reports.js.map +2 -2
  75. package/dist/commands/update.js +56 -24
  76. package/dist/commands/update.js.map +2 -2
  77. package/dist/commands/upgrade.js +99 -11
  78. package/dist/commands/upgrade.js.map +3 -3
  79. package/dist/commands/validate.js +41 -3
  80. package/dist/commands/validate.js.map +2 -2
  81. package/dist/commands/version.js +2 -2
  82. package/dist/commands/version.js.map +2 -2
  83. package/dist/commands/visualize.js +4 -3
  84. package/dist/commands/visualize.js.map +2 -2
  85. package/dist/config.js +83 -0
  86. package/dist/config.js.map +7 -0
  87. package/dist/core/annotation-store.js +138 -0
  88. package/dist/core/annotation-store.js.map +7 -0
  89. package/dist/core/catalog-migration.js +33 -0
  90. package/dist/core/catalog-migration.js.map +7 -0
  91. package/dist/core/changeset-analysis.js +421 -0
  92. package/dist/core/changeset-analysis.js.map +7 -0
  93. package/dist/core/changeset-base-index.js +153 -0
  94. package/dist/core/changeset-base-index.js.map +7 -0
  95. package/dist/core/changeset-brief-delta.js +102 -0
  96. package/dist/core/changeset-brief-delta.js.map +7 -0
  97. package/dist/core/changeset-graph.js +281 -0
  98. package/dist/core/changeset-graph.js.map +7 -0
  99. package/dist/core/changeset-only-guard.js +32 -0
  100. package/dist/core/changeset-only-guard.js.map +7 -0
  101. package/dist/core/changeset-summary.js +68 -0
  102. package/dist/core/changeset-summary.js.map +7 -0
  103. package/dist/core/changeset-validator.js +66 -20
  104. package/dist/core/changeset-validator.js.map +2 -2
  105. package/dist/core/changeset-verify.js +518 -0
  106. package/dist/core/changeset-verify.js.map +7 -0
  107. package/dist/core/changeset.js +56 -9
  108. package/dist/core/changeset.js.map +2 -2
  109. package/dist/core/element-type-migration.js +145 -0
  110. package/dist/core/element-type-migration.js.map +7 -0
  111. package/dist/core/farm-manifest.js +140 -0
  112. package/dist/core/farm-manifest.js.map +7 -0
  113. package/dist/core/farm-sync-engine.js +346 -0
  114. package/dist/core/farm-sync-engine.js.map +7 -0
  115. package/dist/core/farm-sync-state.js +167 -0
  116. package/dist/core/farm-sync-state.js.map +7 -0
  117. package/dist/core/manifest.js +6 -3
  118. package/dist/core/manifest.js.map +2 -2
  119. package/dist/core/migration-registry.js +84 -1
  120. package/dist/core/migration-registry.js.map +2 -2
  121. package/dist/core/model-upgrade.js +102 -0
  122. package/dist/core/model-upgrade.js.map +7 -0
  123. package/dist/core/model.js +257 -44
  124. package/dist/core/model.js.map +3 -3
  125. package/dist/core/mutation-handler.js +71 -6
  126. package/dist/core/mutation-handler.js.map +2 -2
  127. package/dist/core/relationship-migration-table.js +6639 -0
  128. package/dist/core/relationship-migration-table.js.map +7 -0
  129. package/dist/core/relationship-migration.js +272 -0
  130. package/dist/core/relationship-migration.js.map +7 -0
  131. package/dist/core/relationship-prune.js +49 -0
  132. package/dist/core/relationship-prune.js.map +7 -0
  133. package/dist/core/relationship-staging.js +68 -0
  134. package/dist/core/relationship-staging.js.map +7 -0
  135. package/dist/core/relationships.js +26 -4
  136. package/dist/core/relationships.js.map +2 -2
  137. package/dist/core/report-data-model.js +7 -13
  138. package/dist/core/report-data-model.js.map +2 -2
  139. package/dist/core/staged-changeset-storage.js +64 -17
  140. package/dist/core/staged-changeset-storage.js.map +2 -2
  141. package/dist/core/staged-source-reference.js +28 -0
  142. package/dist/core/staged-source-reference.js.map +7 -0
  143. package/dist/core/staging-area.js +83 -18
  144. package/dist/core/staging-area.js.map +2 -2
  145. package/dist/core/virtual-projection.js +14 -5
  146. package/dist/core/virtual-projection.js.map +2 -2
  147. package/dist/export/archimate-exporter.js +1 -0
  148. package/dist/export/archimate-exporter.js.map +2 -2
  149. package/dist/generated/compiled-validators.js +2 -2
  150. package/dist/generated/compiled-validators.js.map +2 -2
  151. package/dist/generated/layer-registry.js +16 -16
  152. package/dist/generated/layer-registry.js.map +2 -2
  153. package/dist/generated/node-types.js +186 -168
  154. package/dist/generated/node-types.js.map +2 -2
  155. package/dist/generated/relationship-index.js +2209 -7727
  156. package/dist/generated/relationship-index.js.map +2 -2
  157. package/dist/integrations/claude_code/agents/dr-architect.md +16 -3
  158. package/dist/integrations/claude_code/agents/dr-extractor.md +1 -1
  159. package/dist/integrations/claude_code/commands/dr-analyzer.md +565 -0
  160. package/dist/integrations/claude_code/commands/dr-map.md +13 -0
  161. package/dist/integrations/claude_code/commands/dr-plan.md +40 -0
  162. package/dist/integrations/claude_code/commands/dr-relate.md +106 -96
  163. package/dist/integrations/claude_code/commands/dr-verify.md +45 -2
  164. package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +14 -0
  165. package/dist/integrations/claude_code/docs/MCP_SERVER.md +79 -0
  166. package/dist/integrations/claude_code/docs/QUICK_START.md +37 -8
  167. package/dist/integrations/claude_code/docs/README.md +52 -1
  168. package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +93 -72
  169. package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +163 -126
  170. package/dist/integrations/claude_code/skills/dr_03_product_layer/SKILL.md +161 -126
  171. package/dist/integrations/claude_code/skills/dr_04_security_layer/SKILL.md +153 -133
  172. package/dist/integrations/claude_code/skills/dr_05_application_layer/SKILL.md +129 -100
  173. package/dist/integrations/claude_code/skills/dr_06_technology_layer/SKILL.md +111 -94
  174. package/dist/integrations/claude_code/skills/dr_07_api_layer/SKILL.md +143 -157
  175. package/dist/integrations/claude_code/skills/dr_08_data_model_layer/SKILL.md +117 -33
  176. package/dist/integrations/claude_code/skills/dr_09_dataset_layer/SKILL.md +74 -25
  177. package/dist/integrations/claude_code/skills/dr_10_ux_layer/SKILL.md +88 -12
  178. package/dist/integrations/claude_code/skills/dr_11_navigation_layer/SKILL.md +83 -24
  179. package/dist/integrations/claude_code/skills/dr_12_apm_layer/SKILL.md +57 -12
  180. package/dist/integrations/claude_code/skills/dr_13_testing_layer/SKILL.md +92 -15
  181. package/dist/integrations/claude_code/skills/dr_change_planning/SKILL.md +119 -0
  182. package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +3 -0
  183. package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +1 -1
  184. package/dist/integrations/github_copilot/agents/dr-architect.md +1 -1
  185. package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +182 -102
  186. package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +266 -148
  187. package/dist/integrations/github_copilot/skills/dr_03_product_layer/SKILL.md +547 -86
  188. package/dist/integrations/github_copilot/skills/dr_04_security_layer/SKILL.md +164 -169
  189. package/dist/integrations/github_copilot/skills/dr_05_application_layer/SKILL.md +420 -150
  190. package/dist/integrations/github_copilot/skills/dr_06_technology_layer/SKILL.md +331 -138
  191. package/dist/integrations/github_copilot/skills/dr_07_api_layer/SKILL.md +265 -201
  192. package/dist/integrations/github_copilot/skills/dr_08_data_model_layer/SKILL.md +181 -58
  193. package/dist/integrations/github_copilot/skills/dr_09_dataset_layer/SKILL.md +209 -57
  194. package/dist/integrations/github_copilot/skills/dr_10_ux_layer/SKILL.md +277 -112
  195. package/dist/integrations/github_copilot/skills/dr_11_navigation_layer/SKILL.md +219 -70
  196. package/dist/integrations/github_copilot/skills/dr_12_apm_layer/SKILL.md +189 -105
  197. package/dist/integrations/github_copilot/skills/dr_13_testing_layer/SKILL.md +222 -102
  198. package/dist/integrations/github_copilot/skills/dr_change_planning/SKILL.md +119 -0
  199. package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +3 -0
  200. package/dist/integrations/hash-utils.js.map +2 -2
  201. package/dist/mcp/api-key-manager.js +111 -0
  202. package/dist/mcp/api-key-manager.js.map +7 -0
  203. package/dist/mcp/changeset-only.js +34 -0
  204. package/dist/mcp/changeset-only.js.map +7 -0
  205. package/dist/mcp/http-transport.js +176 -0
  206. package/dist/mcp/http-transport.js.map +7 -0
  207. package/dist/mcp/resource-registry.js +97 -0
  208. package/dist/mcp/resource-registry.js.map +7 -0
  209. package/dist/mcp/tool-registry.js +60 -0
  210. package/dist/mcp/tool-registry.js.map +7 -0
  211. package/dist/mcp/tools/annotation-create.js +39 -0
  212. package/dist/mcp/tools/annotation-create.js.map +7 -0
  213. package/dist/mcp/tools/annotation-delete.js +29 -0
  214. package/dist/mcp/tools/annotation-delete.js.map +7 -0
  215. package/dist/mcp/tools/annotation-get.js +29 -0
  216. package/dist/mcp/tools/annotation-get.js.map +7 -0
  217. package/dist/mcp/tools/annotation-list.js +24 -0
  218. package/dist/mcp/tools/annotation-list.js.map +7 -0
  219. package/dist/mcp/tools/annotation-reply.js +34 -0
  220. package/dist/mcp/tools/annotation-reply.js.map +7 -0
  221. package/dist/mcp/tools/annotation-shared.js +10 -0
  222. package/dist/mcp/tools/annotation-shared.js.map +7 -0
  223. package/dist/mcp/tools/annotation-update.js +39 -0
  224. package/dist/mcp/tools/annotation-update.js.map +7 -0
  225. package/dist/mcp/tools/changeset-analysis-tools.js +78 -0
  226. package/dist/mcp/tools/changeset-analysis-tools.js.map +7 -0
  227. package/dist/mcp/tools/changeset-editing.js +184 -0
  228. package/dist/mcp/tools/changeset-editing.js.map +7 -0
  229. package/dist/mcp/tools/changeset-lifecycle.js +83 -0
  230. package/dist/mcp/tools/changeset-lifecycle.js.map +7 -0
  231. package/dist/mcp/tools/changeset-list.js +33 -0
  232. package/dist/mcp/tools/changeset-list.js.map +7 -0
  233. package/dist/mcp/tools/changeset-shared.js +31 -0
  234. package/dist/mcp/tools/changeset-shared.js.map +7 -0
  235. package/dist/mcp/tools/changeset-show.js +55 -0
  236. package/dist/mcp/tools/changeset-show.js.map +7 -0
  237. package/dist/mcp/tools/changeset-verify.js +43 -0
  238. package/dist/mcp/tools/changeset-verify.js.map +7 -0
  239. package/dist/mcp/tools/chat-launch.js +50 -0
  240. package/dist/mcp/tools/chat-launch.js.map +7 -0
  241. package/dist/mcp/tools/chat-status.js +26 -0
  242. package/dist/mcp/tools/chat-status.js.map +7 -0
  243. package/dist/mcp/tools/index.js +65 -0
  244. package/dist/mcp/tools/index.js.map +7 -0
  245. package/dist/mcp/tools/model-add.js +107 -0
  246. package/dist/mcp/tools/model-add.js.map +7 -0
  247. package/dist/mcp/tools/model-delete.js +99 -0
  248. package/dist/mcp/tools/model-delete.js.map +7 -0
  249. package/dist/mcp/tools/model-export.js +72 -0
  250. package/dist/mcp/tools/model-export.js.map +7 -0
  251. package/dist/mcp/tools/model-info.js +51 -0
  252. package/dist/mcp/tools/model-info.js.map +7 -0
  253. package/dist/mcp/tools/model-list.js +53 -0
  254. package/dist/mcp/tools/model-list.js.map +7 -0
  255. package/dist/mcp/tools/model-reload.js +34 -0
  256. package/dist/mcp/tools/model-reload.js.map +7 -0
  257. package/dist/mcp/tools/model-search.js +102 -0
  258. package/dist/mcp/tools/model-search.js.map +7 -0
  259. package/dist/mcp/tools/model-show.js +68 -0
  260. package/dist/mcp/tools/model-show.js.map +7 -0
  261. package/dist/mcp/tools/model-stats.js +22 -0
  262. package/dist/mcp/tools/model-stats.js.map +7 -0
  263. package/dist/mcp/tools/model-trace.js +118 -0
  264. package/dist/mcp/tools/model-trace.js.map +7 -0
  265. package/dist/mcp/tools/model-update.js +121 -0
  266. package/dist/mcp/tools/model-update.js.map +7 -0
  267. package/dist/mcp/tools/model-validate.js +78 -0
  268. package/dist/mcp/tools/model-validate.js.map +7 -0
  269. package/dist/mcp/tools/relationship-tools.js +98 -0
  270. package/dist/mcp/tools/relationship-tools.js.map +7 -0
  271. package/dist/mcp/tools/shared.js +126 -0
  272. package/dist/mcp/tools/shared.js.map +7 -0
  273. package/dist/mcp/tools/spec-type.js +90 -0
  274. package/dist/mcp/tools/spec-type.js.map +7 -0
  275. package/dist/reports/model-layer-report-generator.js +5 -3
  276. package/dist/reports/model-layer-report-generator.js.map +2 -2
  277. package/dist/reports/model-readme-generator.js +116 -0
  278. package/dist/reports/model-readme-generator.js.map +7 -0
  279. package/dist/reports/model-report-data.js +37 -1
  280. package/dist/reports/model-report-data.js.map +2 -2
  281. package/dist/reports/model-report-orchestrator.js +29 -6
  282. package/dist/reports/model-report-orchestrator.js.map +2 -2
  283. package/dist/reports/model-report-utils.js +9 -0
  284. package/dist/reports/model-report-utils.js.map +7 -0
  285. package/dist/schemas/bundled/analyzers/cbm.json +1186 -68
  286. package/dist/schemas/bundled/analyzers/manifest.json +2 -2
  287. package/dist/schemas/bundled/api.json +1029 -1658
  288. package/dist/schemas/bundled/apm.json +499 -734
  289. package/dist/schemas/bundled/application.json +745 -370
  290. package/dist/schemas/bundled/base.json +3 -220
  291. package/dist/schemas/bundled/business.json +452 -366
  292. package/dist/schemas/bundled/data-model.json +403 -383
  293. package/dist/schemas/bundled/data-store.json +334 -558
  294. package/dist/schemas/bundled/manifest.json +18 -18
  295. package/dist/schemas/bundled/motivation.json +349 -368
  296. package/dist/schemas/bundled/navigation.json +415 -731
  297. package/dist/schemas/bundled/product.json +325 -159
  298. package/dist/schemas/bundled/security.json +864 -1232
  299. package/dist/schemas/bundled/technology.json +574 -703
  300. package/dist/schemas/bundled/testing.json +718 -1643
  301. package/dist/schemas/bundled/ux.json +739 -1352
  302. package/dist/server/schemas.js +8 -0
  303. package/dist/server/schemas.js.map +2 -2
  304. package/dist/server/server.js +234 -31
  305. package/dist/server/server.js.map +2 -2
  306. package/dist/server-entry.js +2 -1
  307. package/dist/server-entry.js.map +2 -2
  308. package/dist/telemetry/config.js +2 -40
  309. package/dist/telemetry/config.js.map +2 -2
  310. package/dist/telemetry/index.js +1 -1
  311. package/dist/types/index.js.map +2 -2
  312. package/dist/utils/ansi-suppressor.js +23 -0
  313. package/dist/utils/ansi-suppressor.js.map +7 -0
  314. package/dist/utils/attribute-patch.js +41 -0
  315. package/dist/utils/attribute-patch.js.map +7 -0
  316. package/dist/utils/color-utils.js +34 -0
  317. package/dist/utils/color-utils.js.map +7 -0
  318. package/dist/utils/element-reference-shape.js +15 -1
  319. package/dist/utils/element-reference-shape.js.map +3 -3
  320. package/dist/utils/error-hints.js +29 -0
  321. package/dist/utils/error-hints.js.map +7 -0
  322. package/dist/utils/errors.js +75 -10
  323. package/dist/utils/errors.js.map +2 -2
  324. package/dist/utils/globals.js +17 -1
  325. package/dist/utils/globals.js.map +2 -2
  326. package/dist/utils/project-paths.js +50 -3
  327. package/dist/utils/project-paths.js.map +2 -2
  328. package/dist/utils/reference-path-parser.js +49 -0
  329. package/dist/utils/reference-path-parser.js.map +7 -0
  330. package/dist/utils/source-reference.js +17 -10
  331. package/dist/utils/source-reference.js.map +2 -2
  332. package/dist/utils/spec-version.js +10 -2
  333. package/dist/utils/spec-version.js.map +2 -2
  334. package/dist/validators/composed-reference-validator.js +240 -0
  335. package/dist/validators/composed-reference-validator.js.map +7 -0
  336. package/dist/validators/reference-validator.js +57 -13
  337. package/dist/validators/reference-validator.js.map +3 -3
  338. package/dist/validators/relationship-schema-validator.js +33 -5
  339. package/dist/validators/relationship-schema-validator.js.map +3 -3
  340. package/dist/validators/schema-validator.js +27 -9
  341. package/dist/validators/schema-validator.js.map +2 -2
  342. package/dist/validators/types.js.map +1 -1
  343. package/dist/viewer/README.md +6 -6
  344. package/dist/viewer/assets/main-CxzcuU_o.js +84 -0
  345. package/dist/viewer/assets/main-j-7ULYpm.css +1 -0
  346. package/dist/viewer/index.html +2 -2
  347. package/dist/viewer/manifest.json +10 -10
  348. package/dist/viewer/version.json +1 -1
  349. package/package.json +7 -3
  350. package/dist/viewer/assets/main-B7AOQXXX.js +0 -81
  351. package/dist/viewer/assets/main-vdrFrG7q.css +0 -1
@@ -13,13 +13,13 @@ triggers:
13
13
  "request",
14
14
  "response"
15
15
  ]
16
- version: 0.8.1
16
+ version: 0.8.3
17
17
  ---
18
18
 
19
19
  # API Layer Skill
20
20
 
21
21
  **Layer Number:** 06
22
- **Specification:** Metadata Model Spec v0.8.1
22
+ **Specification:** Metadata Model Spec v0.8.3
23
23
  **Purpose:** Defines REST API contracts using OpenAPI 3.0, specifying endpoints, operations, request/response schemas, and security requirements.
24
24
 
25
25
  ---
@@ -81,135 +81,180 @@ This layer uses **OpenAPI 3.0.3** (de facto industry standard) with custom exten
81
81
 
82
82
  ### Supporting Entities (3 entities)
83
83
 
84
- | Entity Type | Description |
85
- | ------------------- | ---------------------------------------- |
86
- | **OAuthFlows** | Configuration for OAuth 2.0 flows |
87
- | **Condition** | Logical expression for policy evaluation |
88
- | **RetentionPolicy** | Data retention policies |
89
- | **ValidationRule** | Data validation constraints |
84
+ | Entity Type | Description |
85
+ | -------------- | ------------------------------------------------------------------------------------------- |
86
+ | **OAuthFlows** | Configuration for OAuth 2.0 flows |
87
+ | **OAuthFlow** | Single OAuth 2.0 flow definition (authorizationCode, implicit, password, clientCredentials) |
88
+ | **RateLimit** | Rate limiting policy for an operation (requests per window, key strategy, action on breach) |
90
89
 
91
90
  ---
92
91
 
93
- ## Intra-Layer Relationships
92
+ ## Type Decision Tree
94
93
 
95
- ### Composition Relationships (Part cannot exist without whole)
96
-
97
- | Source | Predicate | Target | Example |
98
- | --------------- | --------- | -------------- | -------------------------------- |
99
- | OpenAPIDocument | composes | Info | Document has metadata |
100
- | OpenAPIDocument | composes | Paths | Document defines endpoints |
101
- | OpenAPIDocument | composes | Components | Document has reusable components |
102
- | Paths | composes | PathItem | Paths contain path items |
103
- | PathItem | composes | Operation | Path has HTTP methods |
104
- | PathItem | composes | Parameter | Path-level parameters |
105
- | Operation | composes | Parameter | Operation-specific parameters |
106
- | Operation | composes | RequestBody | Request payload definition |
107
- | Operation | composes | Responses | Response definitions |
108
- | Responses | composes | Response | Individual status responses |
109
- | RequestBody | composes | MediaType | Request content types |
110
- | Response | composes | MediaType | Response content types |
111
- | Response | composes | Header | Response headers |
112
- | Response | composes | Link | HATEOAS links |
113
- | MediaType | composes | Schema | Data structure |
114
- | MediaType | composes | Example | Sample data |
115
- | MediaType | composes | Encoding | Serialization details |
116
- | Components | composes | Schema | Reusable schemas |
117
- | Components | composes | Response | Reusable responses |
118
- | Components | composes | Parameter | Reusable parameters |
119
- | Components | composes | Example | Reusable examples |
120
- | Components | composes | RequestBody | Reusable request bodies |
121
- | Components | composes | Header | Reusable headers |
122
- | Components | composes | SecurityScheme | Security definitions |
123
- | Components | composes | Link | Reusable links |
124
- | Components | composes | Callback | Reusable callbacks |
125
- | Info | composes | Contact | API owner contact |
126
- | Info | composes | License | API license |
127
- | SecurityScheme | composes | OAuthFlows | OAuth2 configuration |
128
-
129
- ### Aggregation Relationships (Part can exist independently)
130
-
131
- | Source | Predicate | Target | Example |
132
- | --------------- | ---------- | ------------------- | ------------------------ |
133
- | OpenAPIDocument | aggregates | Server | API deployment servers |
134
- | OpenAPIDocument | aggregates | Tag | Operation tags |
135
- | OpenAPIDocument | aggregates | SecurityRequirement | Global security |
136
- | Server | aggregates | ServerVariable | URL template variables |
137
- | PathItem | aggregates | Parameter | Shared parameters |
138
- | Operation | aggregates | Callback | Webhooks |
139
- | Operation | aggregates | SecurityRequirement | Operation-level security |
94
+ For each construct encountered, ask "what is this?" and assign the first matching type.
140
95
 
141
- ### Reference Relationships
96
+ ```
97
+ Root OpenAPI specification file/object? → api.openapidocument
98
+ API-level metadata (title, description, version)? → api.info
99
+ Contact information for the API owner? → api.contact
100
+ Legal license declaration? → api.license
101
+ Server/host where the API is available (URL)? → api.server
102
+ Variable placeholder in a server URL template (e.g., {version})? → api.servervariable
103
+ Container of all URL paths (the `paths:` block)? → api.paths
104
+ A specific URL path with its available HTTP methods? → api.pathitem
105
+ A single HTTP method on a path (GET, POST, PUT, DELETE, PATCH)? → api.operation
106
+ A parameter — query, path, header, or cookie? → api.parameter
107
+ ↳ NOTE: request bodies are NOT parameters → use api.requestbody
108
+ Request payload/body for an operation? → api.requestbody
109
+ Container of all possible responses for an operation? → api.responses
110
+ ↳ NOTE: not a single response — use api.response for each status code
111
+ A single response for a specific HTTP status code? → api.response
112
+ Media type + schema pair (e.g., application/json with schema)? → api.mediatype
113
+ Data structure / schema definition (JSON Schema subset)? → api.schema
114
+ HTTP header for a request or response? → api.header
115
+ Grouping label used to organize operations? → api.tag
116
+ Reference to external documentation (URL)? → api.externaldocumentation
117
+ Container for reusable definitions (schemas, responses, params)? → api.components
118
+ Security mechanism definition (apiKey, http, oauth2)? → api.securityscheme
119
+ Container of all OAuth 2.0 flow types for a security scheme? → api.oauthflows
120
+ ↳ NOTE: the individual flows inside are NOT api.oauthflows
121
+ A single OAuth 2.0 flow (authorizationCode, implicit, etc.)? → api.oauthflow
122
+ HATEOAS link from a response to a subsequent operation? → api.link
123
+ Webhook / callback URL pattern triggered by an operation? → api.callback
124
+ Sample value for documentation or testing? → api.example
125
+ Serialization details for multipart form content? → api.encoding
126
+ Rate limiting policy (requests per window, key strategy)? → api.ratelimit
127
+ ```
142
128
 
143
- | Source | Predicate | Target | Example |
144
- | --------------- | ---------- | --------------------- | -------------------------------------- |
145
- | Schema | references | Schema | Schema $ref to another schema |
146
- | Parameter | references | Schema | Parameter uses schema |
147
- | Header | references | Schema | Header uses schema |
148
- | Link | references | Operation | Link points to operation (operationId) |
149
- | Callback | references | PathItem | Callback references path definition |
150
- | Operation | references | Tag | Operation tagged for grouping |
151
- | Tag | references | ExternalDocumentation | Tag links to external docs |
152
- | OpenAPIDocument | references | ExternalDocumentation | Document links to external docs |
153
- | Encoding | references | Header | Encoding uses headers |
129
+ ---
154
130
 
155
- ### Specialization Relationships
131
+ ## Common Misclassifications
156
132
 
157
- | Source | Predicate | Target | Example |
158
- | ------ | ----------- | ------ | ---------------------------------------- |
159
- | Schema | specializes | Schema | Schema inheritance (allOf, oneOf, anyOf) |
133
+ | Misclassification | Correct Classification | Why |
134
+ | ------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
135
+ | Using `api.response.*` for the set of all responses | `api.responses.*` is the container; `api.response.*` is a single status code response | `responses` is the plural container; `response` is one entry within it |
136
+ | Using `api.oauthflows.*` for a single flow | `api.oauthflow.*` — each flow variant (authorizationCode, implicit, etc.) is its own node | `oauthflows` is the multi-flow container; `oauthflow` is one flow definition |
137
+ | Modeling schemas inline as `api.mediatype.*` | Schemas are `api.schema.*`; `mediatype` just pairs a content type with a schema reference | MediaType is the content-type envelope; Schema is the data structure inside it |
138
+ | Using `api.parameter.*` for the request body | Request bodies are `api.requestbody.*`; parameters are query/path/header/cookie values only | The OpenAPI spec distinguishes body from parameters explicitly |
139
+ | Using `api.schema.*` for an entire API endpoint | Endpoints are `api.pathitem.*` + `api.operation.*`; schemas are data type definitions only | Schema ≠ endpoint |
140
+ | Putting rate limit config as a property on `api.operation.*` | `api.ratelimit.*` is a dedicated node type for rate limiting policies | Model rate limits as first-class nodes so they can be referenced and reasoned about independently |
141
+ | Using `api.components.*` to represent every reusable object | `api.components.*` is the container; individual reusables (schemas, parameters, etc.) are their own typed nodes composed under it | Components is a structural container, not a substitute for specific types |
160
142
 
161
- ### Behavioral Relationships
143
+ ---
162
144
 
163
- | Source | Predicate | Target | Example |
164
- | -------------- | --------- | --------- | ---------------------------------- |
165
- | Operation | triggers | Callback | Operation invokes webhook |
166
- | SecurityScheme | serves | Operation | Security scheme protects operation |
145
+ ## Intra-Layer Relationships
167
146
 
168
- ### Association Relationships
147
+ ### Composition Relationships (the OpenAPI document tree)
148
+
149
+ Every nesting in an OpenAPI document is `composes`; reuse through `$ref` is `references`, and
150
+ `allOf` inheritance is `specializes`. Link only what an OpenAPI field holds. The API reaches the
151
+ business layer through the application layer, a security scheme links only to security, and API
152
+ schemas reach data stores through data-model schemas.
153
+
154
+ | Source Type | Predicate | Target Type | Example |
155
+ | --------------- | --------- | -------------- | ----------------------------------------------------- |
156
+ | OpenAPIDocument | composes | Info | "Payment API" composes "Payment API Info" |
157
+ | OpenAPIDocument | composes | Paths | "Payment API" composes "Payment API Paths" |
158
+ | OpenAPIDocument | composes | Components | "Payment API" composes "Payment API Components" |
159
+ | Paths | composes | PathItem | "Payment API Paths" composes "/payments/{id}" |
160
+ | PathItem | composes | Operation | "/payments/{id}" composes "getPayment" |
161
+ | Operation | composes | Responses | "getPayment" composes "getPayment Responses" |
162
+ | Responses | composes | Response | "getPayment Responses" composes "200 Payment Found" |
163
+ | RequestBody | composes | MediaType | "Payment Request Body" composes "application/json" |
164
+ | Response | composes | MediaType | "200 Payment Found" composes "application/json" |
165
+ | Response | composes | Header | "201 Created" composes "Location" |
166
+ | Response | composes | Link | "201 Created" composes "GetCreatedPayment" |
167
+ | MediaType | composes | Schema | "application/json" composes "Payment" |
168
+ | MediaType | composes | Encoding | "multipart/form-data" composes "receipt encoding" |
169
+ | Components | composes | Schema | "Payment API Components" composes "Payment" |
170
+ | Components | composes | Parameter | "Payment API Components" composes "PageSize" |
171
+ | Components | composes | Response | "Payment API Components" composes "404 Not Found" |
172
+ | Components | composes | SecurityScheme | "Payment API Components" composes "oauth2-auth" |
173
+ | SecurityScheme | composes | OAuthFlows | "oauth2-auth" composes "oauth2-auth Flows" |
174
+ | OAuthFlows | composes | OAuthFlow | "oauth2-auth Flows" composes "Authorization Code" |
175
+ | OpenAPIDocument | composes | Server | "Payment API" composes "Production Server" |
176
+ | OpenAPIDocument | composes | Tag | "Payment API" composes "payments" |
177
+ | Server | composes | ServerVariable | "Regional Server" composes "region" |
178
+ | Info | composes | Contact | "Payment API Info" composes "Payments Team" |
179
+ | Info | composes | License | "Payment API Info" composes "Apache 2.0" |
180
+ | PathItem | composes | Parameter | "/payments/{id}" composes "paymentId" |
181
+ | Operation | composes | Parameter | "listPayments" composes "status" |
182
+ | Operation | composes | RequestBody | "processPayment" composes "Payment Request Body" |
183
+ | Components | composes | RequestBody | "Payment API Components" composes "Refund Request" |
184
+ | Components | composes | Callback | "Payment API Components" composes "paymentSettled" |
185
+ | Callback | composes | PathItem | "paymentSettled" composes "{$request.body#/callback}" |
186
+ | Operation | composes | Callback | "processPayment" composes "paymentSettled" |
169
187
 
170
- | Source | Predicate | Target | Example |
171
- | ------- | --------------- | --------------- | -------------------- |
172
- | Contact | associated-with | OpenAPIDocument | Contact info for API |
173
- | License | associated-with | OpenAPIDocument | Legal license |
188
+ ### Reference Relationships
174
189
 
175
- ---
190
+ | Source Type | Predicate | Target Type | Example |
191
+ | ----------- | ---------- | --------------------- | ---------------------------------------------- |
192
+ | Schema | references | Schema | "Payment" references "Money" |
193
+ | Parameter | references | Schema | "status" references "PaymentStatus" |
194
+ | Header | references | Schema | "X-Request-Id" references "UUID" |
195
+ | MediaType | references | Schema | "application/json" references "PaymentRequest" |
196
+ | Link | references | Operation | "GetCreatedPayment" references "getPayment" |
197
+ | Operation | references | Tag | "processPayment" references "payments" |
198
+ | Tag | references | ExternalDocumentation | "payments" references "Payments Guide" |
176
199
 
177
- ## Cross-Layer References
200
+ ### Specialization Relationships
178
201
 
179
- ### Outgoing References (API → Other Layers)
202
+ | Source Type | Predicate | Target Type | Example |
203
+ | ----------- | ----------- | ----------- | ------------------------------------------------------- |
204
+ | Schema | specializes | Schema | "CardPayment" specializes "Payment" (allOf) |
205
+ | Header | specializes | Parameter | "X-Request-Id" header specializes "requestId" parameter |
180
206
 
181
- OpenAPI specification includes **custom extensions** (x-\* properties) for cross-layer traceability:
207
+ ### Behavioral Relationships
182
208
 
183
- Cross-layer links to Business and Application layers use `dr relationship add`:
209
+ | Source Type | Predicate | Target Type | Example |
210
+ | --------------- | --------- | -------------- | ------------------------------------------------------ |
211
+ | Operation | uses | SecurityScheme | "processPayment" uses "oauth2-auth" |
212
+ | OpenAPIDocument | requires | SecurityScheme | "Payment API" requires "oauth2-auth" (global) |
213
+ | RateLimit | governs | Operation | "Standard Tier Limit" governs "processPayment" |
214
+ | RateLimit | triggers | Response | "Standard Tier Limit" triggers "429 Too Many Requests" |
184
215
 
185
- ```bash
186
- dr relationship add api.<type>.<name> business.<type>.<name> --predicate realizes
187
- dr relationship add api.<type>.<name> application.<type>.<name> --predicate realizes
188
- ```
189
-
190
- Use `dr catalog types` to list all valid predicates.
216
+ ---
191
217
 
192
- OpenAPI **x-\* properties** (set via `--properties`) are used for same-element metadata:
218
+ ## Cross-Layer References
193
219
 
194
- | Target Layer | Extension Property | Example |
195
- | ------------------------ | ------------------------------- | --------------------------------------------------- |
196
- | **Layer 1 (Motivation)** | `x-supports-goals` | Operation supports business goals |
197
- | **Layer 1 (Motivation)** | `x-fulfills-requirements` | Operation fulfills functional requirements |
198
- | **Layer 1 (Motivation)** | `x-governed-by-principles` | Operation follows architectural principles |
199
- | **Layer 1 (Motivation)** | `x-constrained-by` | Operation subject to constraints (GDPR, HIPAA, SOX) |
200
- | **Layer 7 (Data Model)** | `schema.$ref` | Schema references JSON Schema definition |
201
- | **Layer 3 (Security)** | `x-security-resource` | Operation protected by SecureResource |
202
- | **Layer 3 (Security)** | `x-required-permissions` | Operation requires specific permissions |
203
- | **Layer 3 (Security)** | `x-rate-limit` | Rate limiting configuration |
204
- | **Layer 11 (APM)** | `x-apm-business-metrics` | Operation tracked by business metrics |
205
- | **Layer 11 (APM)** | `x-apm-sla-target-latency` | Expected response time (e.g., "100ms") |
206
- | **Layer 11 (APM)** | `x-apm-sla-target-availability` | Expected availability (e.g., "99.9%") |
207
- | **Layer 11 (APM)** | `x-apm-trace` | Distributed tracing enabled |
208
- | **Layer 11 (APM)** | `x-apm-criticality` | Business criticality (critical, high, medium, low) |
220
+ Cross-layer links are recorded with `dr relationship add`, not with `x-*` extension properties. Value-only
221
+ extensions such as `x-apm-sla-target-latency` or `x-apm-criticality` are still recorded as element
222
+ attributes (see [Custom Extension Reference](#custom-extension-reference)).
209
223
 
210
- ### Incoming References (Lower Layers → API)
224
+ ### Outgoing References (API → Other Layers)
211
225
 
212
- Lower layers reference API layer to show implementation and data structure.
226
+ | Source Type | Predicate | Target Type | Example |
227
+ | --------------- | ---------- | --------------------------------- | ---------------------------------------------------- |
228
+ | OpenAPIDocument | realizes | `application.applicationservice` | "Payment API" realizes "Payment Service" |
229
+ | Operation | realizes | `application.applicationfunction` | "processPayment" realizes "Authorize Payment" |
230
+ | Operation | references | `application.applicationservice` | "submitOrder" references "Order Service" |
231
+ | Operation | exposes | `product.feature` | "exportReport" exposes "CSV Export" |
232
+ | Operation | triggers | `application.applicationevent` | "createOrder" triggers "Order Created" |
233
+ | Server | depends-on | `technology.node` | "Production Server" depends on "EKS Cluster" |
234
+ | Operation | requires | `security.permission` | "refundPayment" requires "payments:refund" |
235
+ | Operation | references | `security.secureresource` | "getPayment" references "Payment Records" |
236
+ | SecurityScheme | realizes | `security.securitypolicy` | "oauth2-auth" realizes "Authenticated Access Policy" |
237
+ | RateLimit | realizes | `security.countermeasure` | "Login Rate Limit" realizes "Brute-force Throttling" |
238
+ | Operation | supports | `motivation.goal` | "processPayment" supports "Reduce Checkout Time" |
239
+ | Operation | satisfies | `motivation.requirement` | "refundPayment" satisfies "Self-service Refunds" |
240
+ | Operation | satisfies | `motivation.constraint` | "exportUserData" satisfies "GDPR Data Portability" |
241
+
242
+ ### Incoming References (Other Layers → API)
243
+
244
+ | Source Type | Predicate | Target Type | Example |
245
+ | ----------------------------- | --------- | -------------- | ------------------------------------------------------ |
246
+ | `data-model.schemadefinition` | maps-to | Schema | "PaymentRequest definition" maps to "PaymentRequest" |
247
+ | `data-model.objectschema` | maps-to | RequestBody | "PaymentRequest object" maps to "Payment Request Body" |
248
+ | `data-model.schemaproperty` | maps-to | Parameter | "payment.status" maps to "status" |
249
+ | `data-store.accesspattern` | maps-to | Operation | "Payments by Customer" maps to "listPayments" |
250
+ | `ux.actioncomponent` | triggers | Operation | "Pay Now Button" triggers "processPayment" |
251
+ | `ux.actioncomponent` | triggers | Operation | "Load More" button triggers `GET /orders` |
252
+ | `navigation.route` | maps-to | PathItem | "/payments/:id route" maps to "/payments/{id}" |
253
+ | `navigation.navigationguard` | uses | SecurityScheme | "Require Login Guard" uses "oauth2-auth" |
254
+ | `apm.metricinstrument` | monitors | Operation | "payment.latency" monitors "processPayment" |
255
+ | `apm.span` | monitors | Operation | "POST /payments span" monitors "processPayment" |
256
+ | `testing.testcasesketch` | tests | Operation | "Declined Card Sketch" tests "processPayment" |
257
+ | `testing.testcasesketch` | tests | Response | "Declined Card Sketch" tests "402 Payment Required" |
213
258
 
214
259
  ---
215
260
 
@@ -495,18 +540,18 @@ components:
495
540
 
496
541
  ```bash
497
542
  # Create the API specification document
498
- dr add api document "payment-api" \
499
- --properties version=3.0.3,title="Payment Processing API",api-version=2.1.0 \
543
+ dr add api openapidocument "payment-api" \
500
544
  --description "API for processing customer payments"
501
545
 
502
546
  # Add API metadata
547
+ # NOTE: api.info requires a companion api.openapidocument to avoid orphan warnings.
548
+ # Always create api.openapidocument first, then link api.info to it via composes.
503
549
  dr add api info "payment-api-info" \
504
- --properties title="Payment Processing API",version=2.1.0,contact-email=api@example.com \
505
550
  --description "API metadata and contact information"
506
551
 
507
- # Link to motivation layer
508
- dr relationship add "api/document/payment-api" \
509
- governed-by "motivation/principle/api-first-design"
552
+ dr relationship add api.openapidocument.payment-api \
553
+ api.info.payment-api-info --predicate composes
554
+
510
555
  ```
511
556
 
512
557
  ### Step 2: Define Servers
@@ -514,12 +559,10 @@ dr relationship add "api/document/payment-api" \
514
559
  ```bash
515
560
  # Production server
516
561
  dr add api server "production-server" \
517
- --properties url=https://api.example.com/v2,description="Production server" \
518
562
  --description "Production API server"
519
563
 
520
564
  # Staging server
521
565
  dr add api server "staging-server" \
522
- --properties url=https://staging-api.example.com/v2,description="Staging server" \
523
566
  --description "Staging API server"
524
567
  ```
525
568
 
@@ -527,13 +570,11 @@ dr add api server "staging-server" \
527
570
 
528
571
  ```bash
529
572
  # OAuth2 security
530
- dr add api security-scheme "oauth2-auth" \
531
- --properties type=oauth2,flow=authorizationCode,authorization-url=https://auth.example.com/oauth/authorize,token-url=https://auth.example.com/oauth/token \
573
+ dr add api securityscheme "oauth2-auth" \
532
574
  --description "OAuth2 authorization code flow"
533
575
 
534
576
  # API Key security
535
- dr add api security-scheme "api-key-auth" \
536
- --properties type=apiKey,in=header,name=X-API-Key \
577
+ dr add api securityscheme "api-key-auth" \
537
578
  --description "API key authentication"
538
579
  ```
539
580
 
@@ -542,17 +583,15 @@ dr add api security-scheme "api-key-auth" \
542
583
  ```bash
543
584
  # Request schema
544
585
  dr add api schema "payment-request" \
545
- --properties type=object,required=amount:currency:payment_method \
546
586
  --description "Payment request payload"
547
587
 
548
588
  # Response schema
549
589
  dr add api schema "payment-response" \
550
- --properties type=object \
551
590
  --description "Payment processing response"
552
591
 
553
- # Link to data model layer
554
- dr relationship add "api/schema/payment-request" \
555
- references "data-model/schema/payment-request"
592
+ # Link from the data model layer
593
+ dr relationship add data-model.schemadefinition.payment-request \
594
+ api.schema.payment-request --predicate maps-to
556
595
  ```
557
596
 
558
597
  ### Step 5: Define Operations (Core Entities)
@@ -560,19 +599,14 @@ dr relationship add "api/schema/payment-request" \
560
599
  ```bash
561
600
  # POST operation
562
601
  dr add api operation "process-payment" \
563
- --properties path=/payments,method=POST,operation-id=processPayment \
564
602
  --description "Processes a payment transaction"
565
603
 
566
- # Add APM and security extensions
567
- dr add api operation "process-payment" \
568
- --properties x-apm-sla-target-latency=500ms,x-apm-sla-target-availability=99.99%,x-apm-criticality=critical,x-required-permissions=payments.write
569
-
570
- # Link to business layer via relationship
571
- dr relationship add api.operation.process-payment business.service.payment-processing --predicate realizes
604
+ # Link to the application layer, which carries the business link
605
+ dr relationship add api.operation.process-payment \
606
+ application.applicationfunction.authorize-payment --predicate realizes
572
607
 
573
608
  # GET operation
574
609
  dr add api operation "get-payment" \
575
- --properties path=/payments/{paymentId},method=GET,operation-id=getPayment \
576
610
  --description "Retrieves payment details by ID"
577
611
  ```
578
612
 
@@ -581,39 +615,35 @@ dr add api operation "get-payment" \
581
615
  ```bash
582
616
  # Path parameter
583
617
  dr add api parameter "payment-id-param" \
584
- --properties name=paymentId,in=path,required=true,type=string,format=uuid \
585
618
  --description "Payment transaction ID"
586
619
 
587
620
  # Query parameter
588
621
  dr add api parameter "status-filter" \
589
- --properties name=status,in=query,required=false,type=string,enum=pending:completed:failed \
590
622
  --description "Filter payments by status"
591
623
 
592
624
  # Link parameter to operation
593
- dr relationship add "api/operation/get-payment" \
594
- has-parameter "api/parameter/payment-id-param"
625
+ dr relationship add api.operation.get-payment \
626
+ api.parameter.payment-id-param --predicate composes
595
627
  ```
596
628
 
597
629
  ### Step 7: Define Request/Response Bodies
598
630
 
599
631
  ```bash
600
632
  # Request body
601
- dr add api request-body "payment-request-body" \
602
- --properties required=true,content-type=application/json \
633
+ dr add api requestbody "payment-request-body" \
603
634
  --description "Payment request payload"
604
635
 
605
- # Link request body to schema
606
- dr relationship add "api/request-body/payment-request-body" \
607
- uses-schema "api/schema/payment-request"
636
+ # Link the request body's media type to its schema
637
+ dr relationship add api.mediatype.payment-request-json \
638
+ api.schema.payment-request --predicate references
608
639
 
609
640
  # Response
610
641
  dr add api response "payment-success-response" \
611
- --properties status-code=201,description="Payment processed successfully" \
612
642
  --description "Successful payment response"
613
643
 
614
- # Link response to schema
615
- dr relationship add "api/response/payment-success-response" \
616
- uses-schema "api/schema/payment-response"
644
+ # Link the response's media type to its schema
645
+ dr relationship add api.mediatype.payment-success-json \
646
+ api.schema.payment-response --predicate references
617
647
  ```
618
648
 
619
649
  ### Step 8: Define Tags for Organization
@@ -621,47 +651,48 @@ dr relationship add "api/response/payment-success-response" \
621
651
  ```bash
622
652
  # Add tags
623
653
  dr add api tag "payments" \
624
- --properties name=Payments \
625
654
  --description "Payment processing operations"
626
655
 
627
656
  dr add api tag "refunds" \
628
- --properties name=Refunds \
629
657
  --description "Refund operations"
630
658
 
631
659
  # Tag operations
632
- dr relationship add "api/operation/process-payment" \
633
- tagged-with "api/tag/payments"
660
+ dr relationship add api.operation.process-payment \
661
+ api.tag.payments --predicate references
634
662
  ```
635
663
 
636
664
  ### Step 9: Cross-Layer Integration
637
665
 
638
666
  ```bash
639
- # Link to business layer
640
- dr relationship add "api/operation/process-payment" \
641
- realizes "business/service/payment-processing"
667
+ # Link to the application layer
668
+ dr relationship add api.openapidocument.payment-api \
669
+ application.applicationservice.payment-service --predicate realizes
642
670
 
643
671
  # Link to application layer
644
- dr relationship add "api/document/payment-api" \
645
- realizes "application/service/payment-api"
672
+ dr relationship add api.openapidocument.payment-api \
673
+ application.applicationservice.payment-service --predicate realizes
646
674
 
647
675
  # Link to security layer
648
- dr relationship add "api/operation/process-payment" \
649
- protected-by "security/secure-resource/payment-api"
676
+ dr relationship add api.operation.process-payment \
677
+ security.secureresource.payment-records --predicate references
678
+
679
+ dr relationship add api.operation.process-payment \
680
+ security.permission.payments-write --predicate requires
650
681
 
651
682
  # Link to motivation layer
652
- dr relationship add "api/operation/process-payment" \
653
- supports "motivation/goal/reduce-checkout-time"
683
+ dr relationship add api.operation.process-payment \
684
+ motivation.goal.reduce-checkout-time --predicate supports
654
685
 
655
- # Link to APM layer
656
- dr relationship add "api/operation/process-payment" \
657
- tracked-by "apm/metric/payment-processing-latency"
686
+ # Link from APM layer (APM monitors the operation)
687
+ dr relationship add apm.metricinstrument.payment-processing-latency \
688
+ api.operation.process-payment --predicate monitors
658
689
  ```
659
690
 
660
691
  ### Step 10: Validate and Export
661
692
 
662
693
  ```bash
663
694
  # Validate API layer
664
- dr validate --layer api
695
+ dr validate --layers api
665
696
 
666
697
  # Export to OpenAPI YAML
667
698
  dr export openapi --output payment-api.yaml
@@ -709,7 +740,7 @@ x-apm-criticality: "low"
709
740
  5. **Document Examples** - Include request/response examples for testing and documentation
710
741
  6. **Security at Operation Level** - Different operations can have different security requirements
711
742
  7. **Link to Business Services** - Use `dr relationship add` to link API operations to business services for traceability
712
- 8. **Define SLA Targets** - Use x-apm-sla-target-\* for monitoring
743
+ 8. **Define SLA Targets** - Use x-apm-sla-target-\* attributes for monitoring
713
744
  9. **Version APIs Properly** - Use semantic versioning (major.minor.patch)
714
745
  10. **Generate from Code** - Use FastAPI, NestJS decorators, or Springdoc to auto-generate OpenAPI specs
715
746
 
@@ -764,44 +795,45 @@ x-apm-criticality: "low"
764
795
  **Add Commands:**
765
796
 
766
797
  ```bash
767
- dr add api document <name> --properties version=3.0.3,title=<title>
768
- dr add api operation <name> --properties path=<path>,method=<method>
769
- dr add api schema <name> --properties type=<type>
770
- dr add api parameter <name> --properties name=<name>,in=<location>
771
- dr add api security-scheme <name> --properties type=<type>
772
- dr add api tag <name> --properties name=<display-name>
798
+ dr add api openapidocument <name>
799
+ dr add api operation <name>
800
+ dr add api schema <name>
801
+ dr add api parameter <name>
802
+ dr add api securityscheme <name>
803
+ dr add api tag <name>
773
804
  ```
774
805
 
775
806
  **Relationship Commands:**
776
807
 
777
808
  ```bash
778
- dr relationship add <operation> uses-schema <schema>
779
- dr relationship add <operation> has-parameter <parameter>
780
- dr relationship add <operation> tagged-with <tag>
781
- dr relationship add <schema> references <schema>
809
+ dr relationship add <response> <schema> --predicate references
810
+ dr relationship add <operation> <parameter> --predicate aggregates
811
+ dr relationship add <operation> <tag> --predicate references
812
+ dr relationship add <operation> <response> --predicate delivers
813
+ dr relationship add <schema> <schema> --predicate references
782
814
  ```
783
815
 
784
816
  **Cross-Layer Commands:**
785
817
 
786
818
  ```bash
787
- dr relationship add api/<operation> realizes business/<service>
788
- dr relationship add api/<document> realizes application/<service>
789
- dr relationship add api/<schema> references data-model/<schema>
790
- dr relationship add api/<operation> protected-by security/<resource>
791
- dr relationship add api/<operation> supports motivation/<goal>
819
+ dr relationship add <api-operation> <business-process> --predicate realizes
820
+ dr relationship add <api-openapidocument> <application-service> --predicate realizes
821
+ dr relationship add <data-model-schemadefinition> <api-schema> --predicate maps-to
822
+ dr relationship add <api-operation> <security-permission> --predicate requires
823
+ dr relationship add <api-operation> <motivation-goal> --predicate realizes
792
824
  ```
793
825
 
794
826
  **Export Commands:**
795
827
 
796
828
  ```bash
797
829
  dr export openapi --output api-spec.yaml
798
- dr export openapi --layer api --format json --output api-spec.json
830
+ dr export openapi --layers api --output api-spec.json
799
831
  ```
800
832
 
801
833
  **Validation Commands:**
802
834
 
803
835
  ```bash
804
- dr validate --layer api
836
+ dr validate --layers api
805
837
  spectral lint api-spec.yaml
806
838
  swagger-cli validate api-spec.yaml
807
839
  ```
@@ -810,35 +842,67 @@ swagger-cli validate api-spec.yaml
810
842
 
811
843
  ## Custom Extension Reference
812
844
 
813
- Documentation Robotics defines custom OpenAPI extensions for cross-layer traceability:
845
+ Documentation Robotics keeps value-only OpenAPI extensions as element attributes:
814
846
 
815
847
  ```yaml
816
- # Motivation Layer Links
817
- x-supports-goals: [motivation/goal/id1, motivation/goal/id2]
818
- x-fulfills-requirements: [motivation/requirement/id1]
819
- x-governed-by-principles: [motivation/principle/id1]
820
- x-constrained-by: [motivation/constraint/id1]
821
-
822
- # Business and Application Layer Links — use dr relationship add (not x-* properties)
823
- # dr relationship add api.<type>.<name> business.<type>.<name> --predicate realizes
824
- # dr relationship add api.<type>.<name> application.<type>.<name> --predicate realizes
825
-
826
- # Security Layer Links
827
- x-security-resource: security/secure-resource/id
828
- x-required-permissions: [users.read, users.write]
829
848
  x-rate-limit:
830
849
  requests: 100
831
850
  window: 60s
832
-
833
- # APM Layer Links
834
- x-apm-business-metrics: [apm/metric/id1]
835
851
  x-apm-sla-target-latency: "100ms"
836
852
  x-apm-sla-target-availability: "99.9%"
837
853
  x-apm-trace: true
838
854
  x-apm-criticality: "high" # critical, high, medium, low
839
855
  ```
840
856
 
841
- These extensions enable full traceability from API operations to business goals, requirements, security controls, and monitoring metrics.
857
+ Extensions that point at elements in other layers are recorded as catalog relationships instead
858
+ (see [Cross-Layer References](#cross-layer-references)):
859
+
860
+ | Legacy extension | Record as |
861
+ | -------------------------- | ----------------------------------------------------------------------------- |
862
+ | `x-supports-goals` | `api.operation` `realizes` `motivation.goal` |
863
+ | `x-fulfills-requirements` | `api.operation` `satisfies` `motivation.requirement` |
864
+ | `x-constrained-by` | `api.operation` `satisfies` `motivation.constraint` |
865
+ | `x-governed-by-principles` | `api.securityscheme` `satisfies` `motivation.principle` (security principles) |
866
+ | `x-security-resource` | `api.operation` `references` `security.secureresource` |
867
+ | `x-required-permissions` | `api.operation` `requires` `security.permission` |
868
+ | `x-apm-business-metrics` | `apm.metricinstrument` `monitors` `api.operation` |
869
+
870
+ ---
871
+
872
+ ## Coverage Completeness Checklist
873
+
874
+ Before declaring API layer extraction complete, verify each type was considered:
875
+
876
+ - [ ] **api.openapidocument** — Root OpenAPI specification document
877
+ - [ ] **api.info** — API metadata (title, version, description)
878
+ - [ ] **api.contact** — Contact information for the API owner
879
+ - [ ] **api.license** — Legal license for the API
880
+ - [ ] **api.server** — Server URLs where the API is available
881
+ - [ ] **api.servervariable** — Variable placeholders in server URL templates
882
+ - [ ] **api.paths** — Container of all API endpoint paths
883
+ - [ ] **api.pathitem** — Operations available on a specific URL path
884
+ - [ ] **api.operation** — Individual HTTP operations (GET, POST, PUT, DELETE, PATCH) — CENTRAL ENTITY
885
+ - [ ] **api.parameter** — Query, path, header, or cookie parameters
886
+ - [ ] **api.requestbody** — Request payload for an operation
887
+ - [ ] **api.responses** — Container of all possible responses for an operation
888
+ - [ ] **api.response** — Single response definition for a specific HTTP status code
889
+ - [ ] **api.mediatype** — Media type + schema pair for request/response bodies
890
+ - [ ] **api.schema** — Data type definitions (JSON Schema subset)
891
+ - [ ] **api.header** — HTTP header parameters
892
+ - [ ] **api.tag** — Grouping labels for organizing operations
893
+ - [ ] **api.externaldocumentation** — References to external documentation
894
+ - [ ] **api.components** — Container for reusable API component definitions
895
+ - [ ] **api.securityscheme** — Security mechanism definitions (apiKey, http, oauth2, openIdConnect)
896
+ - [ ] **api.oauthflows** — OAuth 2.0 flows configuration container
897
+ - [ ] **api.oauthflow** — Single OAuth 2.0 flow (authorizationCode, implicit, password, clientCredentials)
898
+ - [ ] **api.link** — HATEOAS links from responses to subsequent operations
899
+ - [ ] **api.callback** — Webhook / callback URL patterns
900
+ - [ ] **api.example** — Sample values for documentation and testing
901
+ - [ ] **api.encoding** — Serialization details for multipart content
902
+ - [ ] **api.ratelimit** — Rate limiting policies (requests per window, key strategy)
903
+
904
+ If any type has ZERO elements, explicitly decide:
905
+ "This type doesn't apply to this codebase" with reasoning.
842
906
 
843
907
  ---
844
908
 
@@ -852,4 +916,4 @@ The API Layer is the **contract layer** - it defines HOW external consumers inte
852
916
  4. Specify SLA targets for monitoring
853
917
  5. Include examples for documentation and testing
854
918
 
855
- Use OpenAPI 3.0.3 as the foundation, leverage auto-generation tools from your framework, and extend with custom properties for full cross-layer integration.
919
+ Use OpenAPI 3.0.3 as the foundation, leverage auto-generation tools from your framework, and record cross-layer links as catalog relationships for full traceability.