@documentation-robotics/cli 0.2.0 → 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 +36 -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/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 +12 -2
- package/dist/cli.js.map +2 -2
- package/dist/coding-agents/default-permissions.js +31 -1
- package/dist/coding-agents/default-permissions.js.map +2 -2
- package/dist/coding-agents/drbot-mcp.js +167 -0
- package/dist/coding-agents/drbot-mcp.js.map +7 -0
- package/dist/commands/add.js +3 -2
- package/dist/commands/add.js.map +2 -2
- package/dist/commands/analyzer.js +117 -14
- package/dist/commands/analyzer.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 +43 -22
- package/dist/commands/changeset.js.map +2 -2
- package/dist/commands/delete.js +10 -4
- package/dist/commands/delete.js.map +2 -2
- package/dist/commands/farm.js +176 -60
- package/dist/commands/farm.js.map +2 -2
- package/dist/commands/mcp.js +19 -4
- package/dist/commands/mcp.js.map +2 -2
- package/dist/commands/relationship.js +207 -26
- package/dist/commands/relationship.js.map +2 -2
- package/dist/commands/update.js +42 -23
- 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/version.js +1 -1
- package/dist/commands/visualize.js +4 -3
- package/dist/commands/visualize.js.map +2 -2
- 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 +12 -6
- package/dist/core/farm-manifest.js.map +2 -2
- package/dist/core/farm-sync-engine.js +1 -1
- package/dist/core/farm-sync-engine.js.map +2 -2
- package/dist/core/farm-sync-state.js +10 -2
- package/dist/core/farm-sync-state.js.map +2 -2
- package/dist/core/migration-registry.js +75 -46
- 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 +82 -30
- package/dist/core/model.js.map +2 -2
- 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 +13 -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 +2236 -7790
- 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 +26 -2
- package/dist/integrations/claude_code/docs/QUICK_START.md +37 -8
- package/dist/integrations/claude_code/docs/README.md +48 -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 +14 -1
- package/dist/mcp/api-key-manager.js.map +2 -2
- package/dist/mcp/changeset-only.js +34 -0
- package/dist/mcp/changeset-only.js.map +7 -0
- package/dist/mcp/tool-registry.js +19 -3
- package/dist/mcp/tool-registry.js.map +2 -2
- 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-shared.js +31 -0
- package/dist/mcp/tools/changeset-shared.js.map +7 -0
- package/dist/mcp/tools/changeset-show.js +17 -1
- package/dist/mcp/tools/changeset-show.js.map +2 -2
- package/dist/mcp/tools/changeset-verify.js +43 -0
- package/dist/mcp/tools/changeset-verify.js.map +7 -0
- package/dist/mcp/tools/index.js +19 -1
- package/dist/mcp/tools/index.js.map +2 -2
- package/dist/mcp/tools/model-add.js +6 -5
- package/dist/mcp/tools/model-add.js.map +2 -2
- package/dist/mcp/tools/model-delete.js +2 -2
- package/dist/mcp/tools/model-delete.js.map +2 -2
- package/dist/mcp/tools/model-search.js +14 -0
- package/dist/mcp/tools/model-search.js.map +2 -2
- package/dist/mcp/tools/model-show.js +29 -2
- package/dist/mcp/tools/model-show.js.map +2 -2
- package/dist/mcp/tools/model-trace.js +93 -30
- package/dist/mcp/tools/model-trace.js.map +2 -2
- package/dist/mcp/tools/model-update.js +35 -19
- package/dist/mcp/tools/model-update.js.map +2 -2
- 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 +25 -2
- package/dist/mcp/tools/shared.js.map +2 -2
- package/dist/mcp/tools/spec-type.js +90 -0
- package/dist/mcp/tools/spec-type.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 +735 -371
- package/dist/schemas/bundled/base.json +3 -220
- package/dist/schemas/bundled/business.json +452 -366
- package/dist/schemas/bundled/data-model.json +395 -411
- 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 +218 -34
- 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/index.js +1 -1
- package/dist/utils/ansi-suppressor.js +6 -8
- package/dist/utils/ansi-suppressor.js.map +2 -2
- package/dist/utils/attribute-patch.js +41 -0
- package/dist/utils/attribute-patch.js.map +7 -0
- package/dist/utils/error-hints.js +29 -0
- package/dist/utils/error-hints.js.map +7 -0
- package/dist/utils/errors.js +9 -3
- package/dist/utils/errors.js.map +2 -2
- package/dist/utils/project-paths.js +26 -1
- package/dist/utils/project-paths.js.map +2 -2
- package/dist/utils/source-reference.js +14 -12
- package/dist/utils/source-reference.js.map +2 -2
- package/dist/utils/spec-version.js +2 -2
- package/dist/utils/spec-version.js.map +1 -1
- package/dist/validators/composed-reference-validator.js +5 -27
- package/dist/validators/composed-reference-validator.js.map +2 -2
- package/dist/validators/reference-validator.js +0 -7
- package/dist/validators/reference-validator.js.map +2 -2
- package/dist/validators/relationship-schema-validator.js +3 -3
- package/dist/validators/relationship-schema-validator.js.map +2 -2
- 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 +2 -1
- package/dist/viewer/assets/main-B7AOQXXX.js +0 -81
- package/dist/viewer/assets/main-vdrFrG7q.css +0 -1
|
@@ -12,13 +12,13 @@ triggers:
|
|
|
12
12
|
"validation",
|
|
13
13
|
"data type"
|
|
14
14
|
]
|
|
15
|
-
version: 0.8.
|
|
15
|
+
version: 0.8.3
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
# Data Model Layer Skill
|
|
19
19
|
|
|
20
20
|
**Layer Number:** 07
|
|
21
|
-
**Specification:** Metadata Model Spec v0.8.
|
|
21
|
+
**Specification:** Metadata Model Spec v0.8.3
|
|
22
22
|
**Purpose:** Defines logical data structures using JSON Schema Draft 7, specifying entities, properties, validation rules, and data governance.
|
|
23
23
|
|
|
24
24
|
---
|
|
@@ -44,20 +44,55 @@ This layer uses **JSON Schema Draft 7** (industry standard) with custom extensio
|
|
|
44
44
|
> **CLI Introspection:** Run `dr schema types data-model` for the authoritative, always-current list of node types.
|
|
45
45
|
> Run `dr schema node <type-id>` for full attribute details on any type.
|
|
46
46
|
|
|
47
|
-
### Core JSON Schema Entities (
|
|
48
|
-
|
|
49
|
-
| Entity Type | Description
|
|
50
|
-
| --------------------- |
|
|
51
|
-
| **JSONSchema** | Root schema document
|
|
52
|
-
| **ObjectSchema** | Defines object structure with properties
|
|
53
|
-
| **ArraySchema** | Defines array with items and constraints
|
|
54
|
-
| **StringSchema** | String validation (length, pattern, format)
|
|
55
|
-
| **NumericSchema** | Number/integer validation (min, max, multipleOf)
|
|
56
|
-
| **SchemaComposition** | Combines schemas (allOf, anyOf, oneOf, not)
|
|
57
|
-
| **
|
|
58
|
-
| **
|
|
59
|
-
| **
|
|
60
|
-
|
|
47
|
+
### Core JSON Schema Entities (9 types)
|
|
48
|
+
|
|
49
|
+
| Entity Type | Description |
|
|
50
|
+
| --------------------- | ---------------------------------------------------------- |
|
|
51
|
+
| **JSONSchema** | Root schema document |
|
|
52
|
+
| **ObjectSchema** | Defines object structure with properties |
|
|
53
|
+
| **ArraySchema** | Defines array with items and constraints |
|
|
54
|
+
| **StringSchema** | String validation (length, pattern, format) |
|
|
55
|
+
| **NumericSchema** | Number/integer validation (min, max, multipleOf) |
|
|
56
|
+
| **SchemaComposition** | Combines schemas (allOf, anyOf, oneOf, not) |
|
|
57
|
+
| **SchemaDefinition** | Named reusable type for shared use in `definitions` blocks |
|
|
58
|
+
| **SchemaProperty** | Individual property definition |
|
|
59
|
+
| **Reference** | $ref to other schemas |
|
|
60
|
+
|
|
61
|
+
> **Note:** Data governance and database mapping are not node types or `x-...` attributes. Record
|
|
62
|
+
> them as relationships from the schema element they describe: `schemaproperty satisfies
|
|
63
|
+
security.dataclassification` for field-level governance (e.g., marking an `email` property as PII),
|
|
64
|
+
> and `objectschema maps-to data-store.collection` for the physical table or collection.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Type Decision Tree
|
|
69
|
+
|
|
70
|
+
Use this decision tree **before assigning a type** to any code pattern.
|
|
71
|
+
|
|
72
|
+
- Is this a **root JSON Schema document** with `$schema`, `$id`, and `type` fields at the top level? → `data-model.jsonschema`
|
|
73
|
+
- Is this primarily a **schema combinator** using `allOf`, `anyOf`, `oneOf`, or `not` (even if it also has `properties`)? → `data-model.schemacomposition`
|
|
74
|
+
- Is this a **reusable named type** declared in a `definitions` block (has `title` and `type`)? → `data-model.schemadefinition`
|
|
75
|
+
- Is this an **object structure** with `type: object` and `properties`? → `data-model.objectschema`
|
|
76
|
+
- Is this an **array definition** with `items`, `minItems`, `maxItems`, `uniqueItems`, or `contains`? → `data-model.arrayschema`
|
|
77
|
+
- Is this a **string validation rule** with `minLength`, `maxLength`, `pattern`, or `format`? → `data-model.stringschema`
|
|
78
|
+
- Is this a **number/integer validation rule** with `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, or `multipleOf`? → `data-model.numericschema`
|
|
79
|
+
- Is this a **standalone `$ref` pointer** with no additional constraints? → `data-model.reference`
|
|
80
|
+
- Is this an **inline field declaration** within an `objectschema`, carrying its own constraints (`title`, `description`, `readOnly`, `default`, `const`, etc.) alongside or instead of a `$ref`? → `data-model.schemaproperty`
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Common Misclassifications
|
|
85
|
+
|
|
86
|
+
| Misclassification | Correct Classification | Why |
|
|
87
|
+
| ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| Modeling data governance or database mapping as their own elements (or as `x-data-governance` / `x-database` attributes) | Relationships from the schema element: `satisfies security.dataclassification`, `maps-to data-store.collection` | These are cross-layer links, not data-model node types |
|
|
89
|
+
| Using `objectschema` for a reusable definition in a `definitions` block | `schemadefinition` | `definitions` entries are named, reusable definitions; `objectschema` is for structural instances |
|
|
90
|
+
| Using `schemadefinition` for a top-level schema document | `jsonschema` | A root document with `$schema` and `$id` is `jsonschema`, not a definition |
|
|
91
|
+
| Using `schemaproperty` for a standalone string/numeric/array type | `stringschema` / `numericschema` / `arrayschema` | Use the specific schema type when the constraint set is rich enough to stand alone; use `schemaproperty` only for inline field declarations within an `objectschema` |
|
|
92
|
+
| Using `objectschema` for a schema that uses `allOf` to extend another | `schemacomposition` | When the primary purpose is combining or extending schemas, classify as `schemacomposition` — even if the schema also declares `properties` |
|
|
93
|
+
| Using `schemaproperty` for a bare `$ref` with no other constraints | `reference` | A standalone `$ref` with nothing else is a `reference`; use `schemaproperty` only when the field also carries its own constraints (`title`, `description`, `readOnly`, `default`, etc.) |
|
|
94
|
+
| Filing an in-code structure that is neither persisted nor published as a schema under `objectschema` | `application.dataobject` | Entities, ORM models and types whose shape is published as a schema are object schemas; a structure that only carries data between parts of the program is an application data object, which the object schema may realize |
|
|
95
|
+
| A schema `serves` the code that uses it | `application.applicationfunction` (or component, event) `accesses` the schema | Schemas are passive structure: behaviour accesses data; schemas never serve, trigger or perform |
|
|
61
96
|
|
|
62
97
|
---
|
|
63
98
|
|
|
@@ -73,32 +108,101 @@ Activate when the user:
|
|
|
73
108
|
|
|
74
109
|
---
|
|
75
110
|
|
|
76
|
-
##
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
## Intra-Layer Relationships
|
|
112
|
+
|
|
113
|
+
A subschema written in place is part of what declares it (`composes`); a type declared elsewhere and
|
|
114
|
+
reached by `$ref` or by name is `references`. Subtyping is `specializes`.
|
|
115
|
+
|
|
116
|
+
| Source Type | Predicate | Target Type | Example |
|
|
117
|
+
| ----------------- | ----------- | ----------------- | ------------------------------------------------------------------ |
|
|
118
|
+
| JSONSchema | composes | ObjectSchema | "Order API Schemas" document composes its root "Order" schema |
|
|
119
|
+
| JSONSchema | composes | SchemaDefinition | "Order API Schemas" composes the "Address" definition it declares |
|
|
120
|
+
| JSONSchema | composes | SchemaComposition | "Order API Schemas" composes its root "PaymentMethod" (`oneOf`) |
|
|
121
|
+
| ObjectSchema | composes | SchemaProperty | "Order" composes the "status" property |
|
|
122
|
+
| ObjectSchema | specializes | ObjectSchema | "AdminUser" specializes "User" |
|
|
123
|
+
| SchemaProperty | composes | StringSchema | "email" property composes its inline `format: email` constraint |
|
|
124
|
+
| SchemaProperty | composes | NumericSchema | "total" property composes its inline `minimum: 0` constraint |
|
|
125
|
+
| SchemaProperty | composes | ArraySchema | "lineItems" property composes its inline array constraints |
|
|
126
|
+
| SchemaProperty | references | ObjectSchema | "shippingAddress" property references "Address" |
|
|
127
|
+
| SchemaProperty | references | SchemaDefinition | "currency" property references the "CurrencyCode" definition |
|
|
128
|
+
| ArraySchema | composes | ObjectSchema | "LineItemList" composes its inline `items` object schema |
|
|
129
|
+
| ArraySchema | composes | StringSchema | "TagList" composes its inline `items` string schema |
|
|
130
|
+
| ArraySchema | composes | Reference | "OrderList" composes its `items: $ref: #/definitions/Order` |
|
|
131
|
+
| ArraySchema | references | SchemaDefinition | "OrderList" references the "Order" definition its items take |
|
|
132
|
+
| Reference | references | SchemaDefinition | `$ref: #/definitions/Address` references the "Address" definition |
|
|
133
|
+
| Reference | references | ObjectSchema | `$ref` to the "Customer" object schema |
|
|
134
|
+
| Reference | references | JSONSchema | `$ref: common.schema.json` references that document |
|
|
135
|
+
| SchemaComposition | composes | ObjectSchema | "PaymentMethod" (`oneOf`) composes its inline "CardPayment" branch |
|
|
136
|
+
| SchemaComposition | composes | Reference | "CustomerWithAudit" (`allOf`) composes its `$ref` branch |
|
|
137
|
+
| SchemaComposition | references | SchemaDefinition | "CustomerWithAudit" (`allOf`) references "AuditFields" |
|
|
138
|
+
| SchemaDefinition | composes | SchemaDefinition | "Customer" composes "ContactInfo" declared inside it |
|
|
139
|
+
| SchemaDefinition | specializes | SchemaDefinition | "PremiumCustomer" specializes "Customer" |
|
|
140
|
+
| SchemaDefinition | references | SchemaDefinition | "Invoice" references "Customer" |
|
|
141
|
+
|
|
142
|
+
----------------- | ----------- | ----------------- | ----------------------------------------------------------------- |
|
|
143
|
+
| JSONSchema | aggregates | ObjectSchema | "Order API Schemas" document aggregates "Order" |
|
|
144
|
+
| JSONSchema | aggregates | SchemaDefinition | "Order API Schemas" aggregates the "Address" definition |
|
|
145
|
+
| JSONSchema | aggregates | SchemaComposition | "Order API Schemas" aggregates "PaymentMethod" (`oneOf`) |
|
|
146
|
+
| ObjectSchema | aggregates | SchemaProperty | "Order" aggregates the "status" property |
|
|
147
|
+
| ObjectSchema | extends | ObjectSchema | "AdminUser" extends "User" |
|
|
148
|
+
| SchemaProperty | references | StringSchema | "email" property references "EmailString" (`format: email`) |
|
|
149
|
+
| SchemaProperty | references | NumericSchema | "total" property references "MoneyAmount" (`minimum: 0`) |
|
|
150
|
+
| SchemaProperty | references | ArraySchema | "lineItems" property references "LineItemList" |
|
|
151
|
+
| SchemaProperty | references | ObjectSchema | "shippingAddress" property references "Address" |
|
|
152
|
+
| SchemaProperty | references | SchemaDefinition | "currency" property references the "CurrencyCode" definition |
|
|
153
|
+
| ArraySchema | aggregates | ObjectSchema | "LineItemList" aggregates "LineItem" (its `items` schema) |
|
|
154
|
+
| ArraySchema | aggregates | StringSchema | "TagList" aggregates "Tag" |
|
|
155
|
+
| ArraySchema | aggregates | Reference | "OrderList" aggregates `$ref: #/definitions/Order` |
|
|
156
|
+
| Reference | references | SchemaDefinition | `$ref: #/definitions/Address` references the "Address" definition |
|
|
157
|
+
| SchemaComposition | composes | ObjectSchema | "PaymentMethod" (`oneOf`) composes "CardPayment" |
|
|
158
|
+
| SchemaComposition | composes | SchemaDefinition | "CustomerWithAudit" (`allOf`) composes "AuditFields" |
|
|
159
|
+
| SchemaDefinition | composes | SchemaDefinition | "Customer" composes "ContactInfo" |
|
|
160
|
+
| SchemaDefinition | specializes | SchemaDefinition | "PremiumCustomer" specializes "Customer" |
|
|
161
|
+
| SchemaDefinition | references | SchemaDefinition | "Invoice" references "Customer" |
|
|
90
162
|
|
|
91
163
|
---
|
|
92
164
|
|
|
93
|
-
##
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
165
|
+
## Cross-Layer References
|
|
166
|
+
|
|
167
|
+
Cross-layer links are recorded as relationships (`dr relationship add`), not as `x-...` extension attributes.
|
|
168
|
+
|
|
169
|
+
### Outgoing References (Data Model → Other Layers)
|
|
170
|
+
|
|
171
|
+
| Source Type | Predicate | Target Type | Example |
|
|
172
|
+
| ---------------- | ---------- | ----------------------------- | ---------------------------------------------------------------- |
|
|
173
|
+
| ObjectSchema | realizes | `business.businessobject` | "Order" schema realizes the "Customer Order" business object |
|
|
174
|
+
| SchemaDefinition | realizes | `application.dataobject` | "Customer" definition realizes the "Customer Record" data object |
|
|
175
|
+
| ObjectSchema | maps-to | `data-store.collection` | "User" schema maps to the `users` table |
|
|
176
|
+
| SchemaDefinition | maps-to | `data-store.collection` | "AuditEntry" definition maps to the `audit_log` collection |
|
|
177
|
+
| ObjectSchema | maps-to | `api.requestbody` | "CreateOrderRequest" maps to the `POST /orders` request body |
|
|
178
|
+
| ObjectSchema | maps-to | `api.response` | "Order" maps to the `GET /orders/{id}` 200 response |
|
|
179
|
+
| SchemaDefinition | maps-to | `api.schema` | "Address" definition maps to the OpenAPI `Address` component |
|
|
180
|
+
| JSONSchema | maps-to | `api.schema` | "Order API Schemas" document maps to the API's schema set |
|
|
181
|
+
| SchemaProperty | maps-to | `api.parameter` | "orderId" property maps to the `{orderId}` path parameter |
|
|
182
|
+
| SchemaProperty | references | `security.dataclassification` | "email" property references the "PII" classification |
|
|
183
|
+
| SchemaProperty | satisfies | `security.fieldaccesscontrol` | "ssn" property satisfies the "SSN Masking" field control |
|
|
184
|
+
| SchemaProperty | satisfies | `security.validationrule` | "password" property satisfies the "Password Strength" rule |
|
|
185
|
+
| SchemaDefinition | requires | `security.retentionpolicy` | "AuditEntry" requires the "7-Year Audit Retention" policy |
|
|
186
|
+
| ObjectSchema | satisfies | `motivation.requirement` | "Order" satisfies "Orders must record tax breakdown" |
|
|
187
|
+
|
|
188
|
+
### Incoming References (Other Layers → Data Model)
|
|
189
|
+
|
|
190
|
+
| Source Type | Predicate | Target Type | Example |
|
|
191
|
+
| ---------------------------------- | ---------- | ---------------- | ---------------------------------------------------------------- |
|
|
192
|
+
| `application.applicationfunction` | accesses | ObjectSchema | "saveOrder" function accesses the "Order" entity |
|
|
193
|
+
| `application.applicationcomponent` | accesses | ObjectSchema | "OrderRepository" component accesses "Order" |
|
|
194
|
+
| `application.applicationevent` | accesses | SchemaDefinition | "OrderPlaced" event accesses its "OrderPlacedPayload" definition |
|
|
195
|
+
| `ux.dataconfig` | maps-to | ObjectSchema | "Order Form Data" binding maps to the "Order" schema |
|
|
196
|
+
| `ux.dataconfig` | maps-to | ObjectSchema | "Customer Data" maps to "Customer" |
|
|
197
|
+
| `ux.tablecolumn` | maps-to | SchemaProperty | "Status" column maps to the "status" property |
|
|
198
|
+
| `navigation.route` | references | SchemaDefinition | `/orders/:id` route references "Order" |
|
|
199
|
+
| `navigation.contextvariable` | maps-to | SchemaProperty | "selectedOrderId" context variable maps to "orderId" |
|
|
200
|
+
| `testing.targetinputfield` | references | SchemaProperty | "Quantity" input field references "quantity" |
|
|
201
|
+
| `testing.testcasesketch` | tests | SchemaDefinition | "Reject invalid currency" test sketch tests "CurrencyCode" |
|
|
202
|
+
| `apm.metricinstrument` | monitors | SchemaDefinition | "schema_validation_failures" counter monitors "Customer" |
|
|
203
|
+
|
|
204
|
+
> API operations do not point at data-model schemas; the direction is the other way — the schema
|
|
205
|
+
> `maps-to` the API request body, response, or parameter it shapes.
|
|
102
206
|
|
|
103
207
|
---
|
|
104
208
|
|
|
@@ -106,16 +210,16 @@ Activate when the user:
|
|
|
106
210
|
|
|
107
211
|
```bash
|
|
108
212
|
# Add object schema
|
|
109
|
-
dr add
|
|
213
|
+
dr add data-model objectschema "User" --description "User object schema"
|
|
110
214
|
|
|
111
215
|
# List data models
|
|
112
|
-
dr list
|
|
216
|
+
dr list data-model --type objectschema
|
|
113
217
|
|
|
114
218
|
# Validate data model layer
|
|
115
|
-
dr validate --
|
|
219
|
+
dr validate --layers data-model
|
|
116
220
|
|
|
117
221
|
# Export as JSON Schema
|
|
118
|
-
dr export
|
|
222
|
+
dr export jsonschema --layers data-model
|
|
119
223
|
```
|
|
120
224
|
|
|
121
225
|
---
|
|
@@ -123,9 +227,9 @@ dr export --layer data_model --format json-schema
|
|
|
123
227
|
## Example: User Schema
|
|
124
228
|
|
|
125
229
|
```yaml
|
|
126
|
-
id:
|
|
230
|
+
id: data-model.objectschema.user
|
|
127
231
|
name: "User Schema"
|
|
128
|
-
type:
|
|
232
|
+
type: objectschema
|
|
129
233
|
properties:
|
|
130
234
|
type: object
|
|
131
235
|
required: [id, email, username]
|
|
@@ -138,9 +242,6 @@ properties:
|
|
|
138
242
|
type: string
|
|
139
243
|
format: email
|
|
140
244
|
description: "User email address"
|
|
141
|
-
x-data-governance:
|
|
142
|
-
classification: confidential
|
|
143
|
-
pii: true
|
|
144
245
|
username:
|
|
145
246
|
type: string
|
|
146
247
|
minLength: 3
|
|
@@ -154,18 +255,40 @@ properties:
|
|
|
154
255
|
items:
|
|
155
256
|
type: string
|
|
156
257
|
description: "User role assignments"
|
|
157
|
-
x-business-object-ref: business.actor.user
|
|
158
|
-
x-database:
|
|
159
|
-
table: users
|
|
160
|
-
schema: public
|
|
161
258
|
```
|
|
162
259
|
|
|
260
|
+
Link the schema to the business concept, its physical storage, and its data classification with relationships:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
dr relationship add data-model.objectschema.user business.businessobject.user --predicate realizes
|
|
264
|
+
dr relationship add data-model.objectschema.user data-store.collection.users --predicate maps-to
|
|
265
|
+
dr relationship add data-model.schemaproperty.user-email security.dataclassification.pii --predicate references
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Coverage Completeness Checklist
|
|
271
|
+
|
|
272
|
+
Before declaring data-model layer extraction complete, verify each type was considered:
|
|
273
|
+
|
|
274
|
+
- [ ] **arrayschema** — Array definitions with item constraints (e.g., list of strings, paginated results)
|
|
275
|
+
- [ ] **jsonschema** — Root schema documents (top-level `$schema` + `$id` declarations)
|
|
276
|
+
- [ ] **numericschema** — Numeric validation rules (prices, counts, scores with min/max/multipleOf)
|
|
277
|
+
- [ ] **objectschema** — Object structures with named properties (entities, payloads, records)
|
|
278
|
+
- [ ] **reference** — `$ref` pointers to shared or external schemas
|
|
279
|
+
- [ ] **schemacomposition** — Combinators (`allOf` for inheritance, `anyOf`/`oneOf` for polymorphism)
|
|
280
|
+
- [ ] **schemadefinition** — Reusable named definitions in `definitions` blocks
|
|
281
|
+
- [ ] **schemaproperty** — Individual field definitions within object schemas
|
|
282
|
+
- [ ] **stringschema** — String validation rules (lengths, patterns, formats like email/uuid/date-time)
|
|
283
|
+
|
|
284
|
+
If any type has ZERO elements, explicitly decide: "This type doesn't apply to this codebase" with reasoning.
|
|
285
|
+
|
|
163
286
|
---
|
|
164
287
|
|
|
165
|
-
##
|
|
288
|
+
## Modeling Best Practices
|
|
166
289
|
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
290
|
+
- Always specify `type` on schema elements — validation fails without it
|
|
291
|
+
- Break complex schemas into reusable `schemadefinition` entries and reference them via `$ref`
|
|
292
|
+
- Mark PII and sensitive fields with a `satisfies` relationship from the `schemaproperty` to a `security.dataclassification`
|
|
293
|
+
- Link schemas to the Business Layer with `realizes business.businessobject` and to the Data Store Layer with `maps-to data-store.collection`
|
|
294
|
+
- Use `format` for semantic string types (`email`, `uuid`, `date-time`, `uri`) rather than custom `pattern` where a standard format exists
|