@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.
- package/README.md +74 -2
- package/dist/analysis/relationship-classifier.js +2 -9
- package/dist/analysis/relationship-classifier.js.map +2 -2
- package/dist/analyzers/call-graph-utils.js +2 -2
- package/dist/analyzers/call-graph-utils.js.map +2 -2
- package/dist/analyzers/cards/build.js +171 -0
- package/dist/analyzers/cards/build.js.map +7 -0
- package/dist/analyzers/cards/classify.js +42 -0
- package/dist/analyzers/cards/classify.js.map +7 -0
- package/dist/analyzers/cards/edge-index.js +44 -0
- package/dist/analyzers/cards/edge-index.js.map +7 -0
- package/dist/analyzers/cards/facts.js +46 -0
- package/dist/analyzers/cards/facts.js.map +7 -0
- package/dist/analyzers/cards/graph.js +42 -0
- package/dist/analyzers/cards/graph.js.map +7 -0
- package/dist/analyzers/cards/index.js +8 -0
- package/dist/analyzers/cards/index.js.map +7 -0
- package/dist/analyzers/cards/tier0.js +18 -0
- package/dist/analyzers/cards/tier0.js.map +7 -0
- package/dist/analyzers/cards/types.js +1 -0
- package/dist/analyzers/cards/types.js.map +7 -0
- package/dist/analyzers/cbm-analyzer.js +195 -171
- package/dist/analyzers/cbm-analyzer.js.map +2 -2
- package/dist/analyzers/cbm-responses.js +336 -0
- package/dist/analyzers/cbm-responses.js.map +7 -0
- package/dist/analyzers/edge-relationships.js +45 -0
- package/dist/analyzers/edge-relationships.js.map +7 -0
- package/dist/analyzers/mapping-loader.js +9 -0
- package/dist/analyzers/mapping-loader.js.map +2 -2
- package/dist/analyzers/tier0-rules.js +153 -0
- package/dist/analyzers/tier0-rules.js.map +7 -0
- package/dist/analyzers/types.js.map +1 -1
- package/dist/analyzers/verify-engine.js +22 -19
- package/dist/analyzers/verify-engine.js.map +2 -2
- package/dist/audit/relationships/ai/prompts.js +10 -10
- package/dist/audit/relationships/ai/prompts.js.map +2 -2
- package/dist/audit/relationships/analysis/layer-templates.js +52 -52
- package/dist/audit/relationships/analysis/layer-templates.js.map +1 -1
- package/dist/cli.js +112 -28
- package/dist/cli.js.map +3 -3
- package/dist/coding-agents/agents/claude-code.js +3 -1
- package/dist/coding-agents/agents/claude-code.js.map +2 -2
- package/dist/coding-agents/claude-code-client.js +2 -1
- package/dist/coding-agents/claude-code-client.js.map +2 -2
- package/dist/coding-agents/copilot-client.js +17 -12
- package/dist/coding-agents/copilot-client.js.map +2 -2
- package/dist/coding-agents/default-permissions.js +152 -0
- package/dist/coding-agents/default-permissions.js.map +7 -0
- package/dist/coding-agents/drbot-mcp.js +167 -0
- package/dist/coding-agents/drbot-mcp.js.map +7 -0
- package/dist/commands/add.js +12 -7
- package/dist/commands/add.js.map +2 -2
- package/dist/commands/analyzer.js +134 -23
- package/dist/commands/analyzer.js.map +2 -2
- package/dist/commands/audit.js +6 -6
- package/dist/commands/audit.js.map +2 -2
- package/dist/commands/changeset-verify.js +55 -0
- package/dist/commands/changeset-verify.js.map +7 -0
- package/dist/commands/changeset.js +261 -147
- package/dist/commands/changeset.js.map +2 -2
- package/dist/commands/delete.js +52 -19
- package/dist/commands/delete.js.map +3 -3
- package/dist/commands/element.js +3 -2
- package/dist/commands/element.js.map +2 -2
- package/dist/commands/farm.js +773 -0
- package/dist/commands/farm.js.map +7 -0
- package/dist/commands/init.js +11 -1
- package/dist/commands/init.js.map +2 -2
- package/dist/commands/mcp.js +122 -0
- package/dist/commands/mcp.js.map +7 -0
- package/dist/commands/relationship.js +251 -47
- package/dist/commands/relationship.js.map +2 -2
- package/dist/commands/reports.js +1 -1
- package/dist/commands/reports.js.map +2 -2
- package/dist/commands/update.js +56 -24
- package/dist/commands/update.js.map +2 -2
- package/dist/commands/upgrade.js +99 -11
- package/dist/commands/upgrade.js.map +3 -3
- package/dist/commands/validate.js +41 -3
- package/dist/commands/validate.js.map +2 -2
- package/dist/commands/version.js +2 -2
- package/dist/commands/version.js.map +2 -2
- package/dist/commands/visualize.js +4 -3
- package/dist/commands/visualize.js.map +2 -2
- package/dist/config.js +83 -0
- package/dist/config.js.map +7 -0
- package/dist/core/annotation-store.js +138 -0
- package/dist/core/annotation-store.js.map +7 -0
- package/dist/core/catalog-migration.js +33 -0
- package/dist/core/catalog-migration.js.map +7 -0
- package/dist/core/changeset-analysis.js +421 -0
- package/dist/core/changeset-analysis.js.map +7 -0
- package/dist/core/changeset-base-index.js +153 -0
- package/dist/core/changeset-base-index.js.map +7 -0
- package/dist/core/changeset-brief-delta.js +102 -0
- package/dist/core/changeset-brief-delta.js.map +7 -0
- package/dist/core/changeset-graph.js +281 -0
- package/dist/core/changeset-graph.js.map +7 -0
- package/dist/core/changeset-only-guard.js +32 -0
- package/dist/core/changeset-only-guard.js.map +7 -0
- package/dist/core/changeset-summary.js +68 -0
- package/dist/core/changeset-summary.js.map +7 -0
- package/dist/core/changeset-validator.js +66 -20
- package/dist/core/changeset-validator.js.map +2 -2
- package/dist/core/changeset-verify.js +518 -0
- package/dist/core/changeset-verify.js.map +7 -0
- package/dist/core/changeset.js +56 -9
- package/dist/core/changeset.js.map +2 -2
- package/dist/core/element-type-migration.js +145 -0
- package/dist/core/element-type-migration.js.map +7 -0
- package/dist/core/farm-manifest.js +140 -0
- package/dist/core/farm-manifest.js.map +7 -0
- package/dist/core/farm-sync-engine.js +346 -0
- package/dist/core/farm-sync-engine.js.map +7 -0
- package/dist/core/farm-sync-state.js +167 -0
- package/dist/core/farm-sync-state.js.map +7 -0
- package/dist/core/manifest.js +6 -3
- package/dist/core/manifest.js.map +2 -2
- package/dist/core/migration-registry.js +84 -1
- package/dist/core/migration-registry.js.map +2 -2
- package/dist/core/model-upgrade.js +102 -0
- package/dist/core/model-upgrade.js.map +7 -0
- package/dist/core/model.js +257 -44
- package/dist/core/model.js.map +3 -3
- package/dist/core/mutation-handler.js +71 -6
- package/dist/core/mutation-handler.js.map +2 -2
- package/dist/core/relationship-migration-table.js +6639 -0
- package/dist/core/relationship-migration-table.js.map +7 -0
- package/dist/core/relationship-migration.js +272 -0
- package/dist/core/relationship-migration.js.map +7 -0
- package/dist/core/relationship-prune.js +49 -0
- package/dist/core/relationship-prune.js.map +7 -0
- package/dist/core/relationship-staging.js +68 -0
- package/dist/core/relationship-staging.js.map +7 -0
- package/dist/core/relationships.js +26 -4
- package/dist/core/relationships.js.map +2 -2
- package/dist/core/report-data-model.js +7 -13
- package/dist/core/report-data-model.js.map +2 -2
- package/dist/core/staged-changeset-storage.js +64 -17
- package/dist/core/staged-changeset-storage.js.map +2 -2
- package/dist/core/staged-source-reference.js +28 -0
- package/dist/core/staged-source-reference.js.map +7 -0
- package/dist/core/staging-area.js +83 -18
- package/dist/core/staging-area.js.map +2 -2
- package/dist/core/virtual-projection.js +14 -5
- package/dist/core/virtual-projection.js.map +2 -2
- package/dist/export/archimate-exporter.js +1 -0
- package/dist/export/archimate-exporter.js.map +2 -2
- package/dist/generated/compiled-validators.js +2 -2
- package/dist/generated/compiled-validators.js.map +2 -2
- package/dist/generated/layer-registry.js +16 -16
- package/dist/generated/layer-registry.js.map +2 -2
- package/dist/generated/node-types.js +186 -168
- package/dist/generated/node-types.js.map +2 -2
- package/dist/generated/relationship-index.js +2209 -7727
- package/dist/generated/relationship-index.js.map +2 -2
- package/dist/integrations/claude_code/agents/dr-architect.md +16 -3
- package/dist/integrations/claude_code/agents/dr-extractor.md +1 -1
- package/dist/integrations/claude_code/commands/dr-analyzer.md +565 -0
- package/dist/integrations/claude_code/commands/dr-map.md +13 -0
- package/dist/integrations/claude_code/commands/dr-plan.md +40 -0
- package/dist/integrations/claude_code/commands/dr-relate.md +106 -96
- package/dist/integrations/claude_code/commands/dr-verify.md +45 -2
- package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +14 -0
- package/dist/integrations/claude_code/docs/MCP_SERVER.md +79 -0
- package/dist/integrations/claude_code/docs/QUICK_START.md +37 -8
- package/dist/integrations/claude_code/docs/README.md +52 -1
- package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +93 -72
- package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +163 -126
- package/dist/integrations/claude_code/skills/dr_03_product_layer/SKILL.md +161 -126
- package/dist/integrations/claude_code/skills/dr_04_security_layer/SKILL.md +153 -133
- package/dist/integrations/claude_code/skills/dr_05_application_layer/SKILL.md +129 -100
- package/dist/integrations/claude_code/skills/dr_06_technology_layer/SKILL.md +111 -94
- package/dist/integrations/claude_code/skills/dr_07_api_layer/SKILL.md +143 -157
- package/dist/integrations/claude_code/skills/dr_08_data_model_layer/SKILL.md +117 -33
- package/dist/integrations/claude_code/skills/dr_09_dataset_layer/SKILL.md +74 -25
- package/dist/integrations/claude_code/skills/dr_10_ux_layer/SKILL.md +88 -12
- package/dist/integrations/claude_code/skills/dr_11_navigation_layer/SKILL.md +83 -24
- package/dist/integrations/claude_code/skills/dr_12_apm_layer/SKILL.md +57 -12
- package/dist/integrations/claude_code/skills/dr_13_testing_layer/SKILL.md +92 -15
- package/dist/integrations/claude_code/skills/dr_change_planning/SKILL.md +119 -0
- package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +3 -0
- package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +1 -1
- package/dist/integrations/github_copilot/agents/dr-architect.md +1 -1
- package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +182 -102
- package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +266 -148
- package/dist/integrations/github_copilot/skills/dr_03_product_layer/SKILL.md +547 -86
- package/dist/integrations/github_copilot/skills/dr_04_security_layer/SKILL.md +164 -169
- package/dist/integrations/github_copilot/skills/dr_05_application_layer/SKILL.md +420 -150
- package/dist/integrations/github_copilot/skills/dr_06_technology_layer/SKILL.md +331 -138
- package/dist/integrations/github_copilot/skills/dr_07_api_layer/SKILL.md +265 -201
- package/dist/integrations/github_copilot/skills/dr_08_data_model_layer/SKILL.md +181 -58
- package/dist/integrations/github_copilot/skills/dr_09_dataset_layer/SKILL.md +209 -57
- package/dist/integrations/github_copilot/skills/dr_10_ux_layer/SKILL.md +277 -112
- package/dist/integrations/github_copilot/skills/dr_11_navigation_layer/SKILL.md +219 -70
- package/dist/integrations/github_copilot/skills/dr_12_apm_layer/SKILL.md +189 -105
- package/dist/integrations/github_copilot/skills/dr_13_testing_layer/SKILL.md +222 -102
- package/dist/integrations/github_copilot/skills/dr_change_planning/SKILL.md +119 -0
- package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +3 -0
- package/dist/integrations/hash-utils.js.map +2 -2
- package/dist/mcp/api-key-manager.js +111 -0
- package/dist/mcp/api-key-manager.js.map +7 -0
- package/dist/mcp/changeset-only.js +34 -0
- package/dist/mcp/changeset-only.js.map +7 -0
- package/dist/mcp/http-transport.js +176 -0
- package/dist/mcp/http-transport.js.map +7 -0
- package/dist/mcp/resource-registry.js +97 -0
- package/dist/mcp/resource-registry.js.map +7 -0
- package/dist/mcp/tool-registry.js +60 -0
- package/dist/mcp/tool-registry.js.map +7 -0
- package/dist/mcp/tools/annotation-create.js +39 -0
- package/dist/mcp/tools/annotation-create.js.map +7 -0
- package/dist/mcp/tools/annotation-delete.js +29 -0
- package/dist/mcp/tools/annotation-delete.js.map +7 -0
- package/dist/mcp/tools/annotation-get.js +29 -0
- package/dist/mcp/tools/annotation-get.js.map +7 -0
- package/dist/mcp/tools/annotation-list.js +24 -0
- package/dist/mcp/tools/annotation-list.js.map +7 -0
- package/dist/mcp/tools/annotation-reply.js +34 -0
- package/dist/mcp/tools/annotation-reply.js.map +7 -0
- package/dist/mcp/tools/annotation-shared.js +10 -0
- package/dist/mcp/tools/annotation-shared.js.map +7 -0
- package/dist/mcp/tools/annotation-update.js +39 -0
- package/dist/mcp/tools/annotation-update.js.map +7 -0
- package/dist/mcp/tools/changeset-analysis-tools.js +78 -0
- package/dist/mcp/tools/changeset-analysis-tools.js.map +7 -0
- package/dist/mcp/tools/changeset-editing.js +184 -0
- package/dist/mcp/tools/changeset-editing.js.map +7 -0
- package/dist/mcp/tools/changeset-lifecycle.js +83 -0
- package/dist/mcp/tools/changeset-lifecycle.js.map +7 -0
- package/dist/mcp/tools/changeset-list.js +33 -0
- package/dist/mcp/tools/changeset-list.js.map +7 -0
- package/dist/mcp/tools/changeset-shared.js +31 -0
- package/dist/mcp/tools/changeset-shared.js.map +7 -0
- package/dist/mcp/tools/changeset-show.js +55 -0
- package/dist/mcp/tools/changeset-show.js.map +7 -0
- package/dist/mcp/tools/changeset-verify.js +43 -0
- package/dist/mcp/tools/changeset-verify.js.map +7 -0
- package/dist/mcp/tools/chat-launch.js +50 -0
- package/dist/mcp/tools/chat-launch.js.map +7 -0
- package/dist/mcp/tools/chat-status.js +26 -0
- package/dist/mcp/tools/chat-status.js.map +7 -0
- package/dist/mcp/tools/index.js +65 -0
- package/dist/mcp/tools/index.js.map +7 -0
- package/dist/mcp/tools/model-add.js +107 -0
- package/dist/mcp/tools/model-add.js.map +7 -0
- package/dist/mcp/tools/model-delete.js +99 -0
- package/dist/mcp/tools/model-delete.js.map +7 -0
- package/dist/mcp/tools/model-export.js +72 -0
- package/dist/mcp/tools/model-export.js.map +7 -0
- package/dist/mcp/tools/model-info.js +51 -0
- package/dist/mcp/tools/model-info.js.map +7 -0
- package/dist/mcp/tools/model-list.js +53 -0
- package/dist/mcp/tools/model-list.js.map +7 -0
- package/dist/mcp/tools/model-reload.js +34 -0
- package/dist/mcp/tools/model-reload.js.map +7 -0
- package/dist/mcp/tools/model-search.js +102 -0
- package/dist/mcp/tools/model-search.js.map +7 -0
- package/dist/mcp/tools/model-show.js +68 -0
- package/dist/mcp/tools/model-show.js.map +7 -0
- package/dist/mcp/tools/model-stats.js +22 -0
- package/dist/mcp/tools/model-stats.js.map +7 -0
- package/dist/mcp/tools/model-trace.js +118 -0
- package/dist/mcp/tools/model-trace.js.map +7 -0
- package/dist/mcp/tools/model-update.js +121 -0
- package/dist/mcp/tools/model-update.js.map +7 -0
- package/dist/mcp/tools/model-validate.js +78 -0
- package/dist/mcp/tools/model-validate.js.map +7 -0
- package/dist/mcp/tools/relationship-tools.js +98 -0
- package/dist/mcp/tools/relationship-tools.js.map +7 -0
- package/dist/mcp/tools/shared.js +126 -0
- package/dist/mcp/tools/shared.js.map +7 -0
- package/dist/mcp/tools/spec-type.js +90 -0
- package/dist/mcp/tools/spec-type.js.map +7 -0
- package/dist/reports/model-layer-report-generator.js +5 -3
- package/dist/reports/model-layer-report-generator.js.map +2 -2
- package/dist/reports/model-readme-generator.js +116 -0
- package/dist/reports/model-readme-generator.js.map +7 -0
- package/dist/reports/model-report-data.js +37 -1
- package/dist/reports/model-report-data.js.map +2 -2
- package/dist/reports/model-report-orchestrator.js +29 -6
- package/dist/reports/model-report-orchestrator.js.map +2 -2
- package/dist/reports/model-report-utils.js +9 -0
- package/dist/reports/model-report-utils.js.map +7 -0
- package/dist/schemas/bundled/analyzers/cbm.json +1186 -68
- package/dist/schemas/bundled/analyzers/manifest.json +2 -2
- package/dist/schemas/bundled/api.json +1029 -1658
- package/dist/schemas/bundled/apm.json +499 -734
- package/dist/schemas/bundled/application.json +745 -370
- package/dist/schemas/bundled/base.json +3 -220
- package/dist/schemas/bundled/business.json +452 -366
- package/dist/schemas/bundled/data-model.json +403 -383
- package/dist/schemas/bundled/data-store.json +334 -558
- package/dist/schemas/bundled/manifest.json +18 -18
- package/dist/schemas/bundled/motivation.json +349 -368
- package/dist/schemas/bundled/navigation.json +415 -731
- package/dist/schemas/bundled/product.json +325 -159
- package/dist/schemas/bundled/security.json +864 -1232
- package/dist/schemas/bundled/technology.json +574 -703
- package/dist/schemas/bundled/testing.json +718 -1643
- package/dist/schemas/bundled/ux.json +739 -1352
- package/dist/server/schemas.js +8 -0
- package/dist/server/schemas.js.map +2 -2
- package/dist/server/server.js +234 -31
- package/dist/server/server.js.map +2 -2
- package/dist/server-entry.js +2 -1
- package/dist/server-entry.js.map +2 -2
- package/dist/telemetry/config.js +2 -40
- package/dist/telemetry/config.js.map +2 -2
- package/dist/telemetry/index.js +1 -1
- package/dist/types/index.js.map +2 -2
- package/dist/utils/ansi-suppressor.js +23 -0
- package/dist/utils/ansi-suppressor.js.map +7 -0
- package/dist/utils/attribute-patch.js +41 -0
- package/dist/utils/attribute-patch.js.map +7 -0
- package/dist/utils/color-utils.js +34 -0
- package/dist/utils/color-utils.js.map +7 -0
- package/dist/utils/element-reference-shape.js +15 -1
- package/dist/utils/element-reference-shape.js.map +3 -3
- package/dist/utils/error-hints.js +29 -0
- package/dist/utils/error-hints.js.map +7 -0
- package/dist/utils/errors.js +75 -10
- package/dist/utils/errors.js.map +2 -2
- package/dist/utils/globals.js +17 -1
- package/dist/utils/globals.js.map +2 -2
- package/dist/utils/project-paths.js +50 -3
- package/dist/utils/project-paths.js.map +2 -2
- package/dist/utils/reference-path-parser.js +49 -0
- package/dist/utils/reference-path-parser.js.map +7 -0
- package/dist/utils/source-reference.js +17 -10
- package/dist/utils/source-reference.js.map +2 -2
- package/dist/utils/spec-version.js +10 -2
- package/dist/utils/spec-version.js.map +2 -2
- package/dist/validators/composed-reference-validator.js +240 -0
- package/dist/validators/composed-reference-validator.js.map +7 -0
- package/dist/validators/reference-validator.js +57 -13
- package/dist/validators/reference-validator.js.map +3 -3
- package/dist/validators/relationship-schema-validator.js +33 -5
- package/dist/validators/relationship-schema-validator.js.map +3 -3
- package/dist/validators/schema-validator.js +27 -9
- package/dist/validators/schema-validator.js.map +2 -2
- package/dist/validators/types.js.map +1 -1
- package/dist/viewer/README.md +6 -6
- package/dist/viewer/assets/main-CxzcuU_o.js +84 -0
- package/dist/viewer/assets/main-j-7ULYpm.css +1 -0
- package/dist/viewer/index.html +2 -2
- package/dist/viewer/manifest.json +10 -10
- package/dist/viewer/version.json +1 -1
- package/package.json +7 -3
- package/dist/viewer/assets/main-B7AOQXXX.js +0 -81
- 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.
|
|
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.
|
|
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
|
|
85
|
-
|
|
|
86
|
-
| **OAuthFlows**
|
|
87
|
-
| **
|
|
88
|
-
| **
|
|
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
|
-
##
|
|
92
|
+
## Type Decision Tree
|
|
94
93
|
|
|
95
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
131
|
+
## Common Misclassifications
|
|
156
132
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
|
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
|
-
|
|
143
|
+
---
|
|
162
144
|
|
|
163
|
-
|
|
164
|
-
| -------------- | --------- | --------- | ---------------------------------- |
|
|
165
|
-
| Operation | triggers | Callback | Operation invokes webhook |
|
|
166
|
-
| SecurityScheme | serves | Operation | Security scheme protects operation |
|
|
145
|
+
## Intra-Layer Relationships
|
|
167
146
|
|
|
168
|
-
###
|
|
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
|
-
|
|
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
|
-
|
|
200
|
+
### Specialization Relationships
|
|
178
201
|
|
|
179
|
-
|
|
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
|
-
|
|
207
|
+
### Behavioral Relationships
|
|
182
208
|
|
|
183
|
-
|
|
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
|
-
|
|
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
|
-
|
|
218
|
+
## Cross-Layer References
|
|
193
219
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
###
|
|
224
|
+
### Outgoing References (API → Other Layers)
|
|
211
225
|
|
|
212
|
-
|
|
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
|
|
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
|
-
|
|
508
|
-
|
|
509
|
-
|
|
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
|
|
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
|
|
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
|
|
554
|
-
dr relationship add
|
|
555
|
-
|
|
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
|
-
#
|
|
567
|
-
dr add api
|
|
568
|
-
--
|
|
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
|
|
594
|
-
|
|
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
|
|
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
|
|
607
|
-
|
|
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
|
|
616
|
-
|
|
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
|
|
633
|
-
|
|
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
|
|
640
|
-
dr relationship add
|
|
641
|
-
|
|
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
|
|
645
|
-
|
|
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
|
|
649
|
-
|
|
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
|
|
653
|
-
|
|
683
|
+
dr relationship add api.operation.process-payment \
|
|
684
|
+
motivation.goal.reduce-checkout-time --predicate supports
|
|
654
685
|
|
|
655
|
-
# Link
|
|
656
|
-
dr relationship add
|
|
657
|
-
|
|
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 --
|
|
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
|
|
768
|
-
dr add api operation <name>
|
|
769
|
-
dr add api schema <name>
|
|
770
|
-
dr add api parameter <name>
|
|
771
|
-
dr add api
|
|
772
|
-
dr add api tag <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 <
|
|
779
|
-
dr relationship add <operation>
|
|
780
|
-
dr relationship add <operation>
|
|
781
|
-
dr relationship add <
|
|
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
|
|
788
|
-
dr relationship add api
|
|
789
|
-
dr relationship add api
|
|
790
|
-
dr relationship add api
|
|
791
|
-
dr relationship add api
|
|
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 --
|
|
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 --
|
|
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
|
|
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
|
-
|
|
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
|
|
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.
|