feat: Relationship Cardinality & Data Flow Annotations (#289)#370
Conversation
raifdmueller
left a comment
There was a problem hiding this comment.
Code Review
The cardinality and data flow annotations are well-designed and backward-compatible. One issue before merging:
Schema missing enum constraints: The new cardinality and dataFlow fields are defined as plain strings in the JSON schema. Valid values like "1:1", "1:N", "sync", "async" should be listed as enum entries so IDE autocompletion and schema validation enforce them — otherwise the schema provides no guidance to users.
Minor: "sync" exists as both a DataFlow constant and a StepType constant in types.go — worth a comment to clarify they are independent domains.
Please add `"enum": [...]" to the cardinality and dataFlow schema definitions before merging.
- Add Cardinality field to Relationship struct (1:1, 1:N, N:N) - Add DataFlow field to Relationship struct (sync, async, request/response, publish/subscribe) - Add constants and validation lists for valid cardinality and data flow values - Implement validation in validateRelationships() for cardinality and data flow values - Add comprehensive unit tests for cardinality and data flow validation - Support optional cardinality and data flow annotations on all relationships Enables precise communication of integration patterns and data relationship semantics in architecture models. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Schema updated to reflect new relationship cardinality and data flow annotation fields added in this feature. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
8302a24 to
78191f9
Compare
📊 Test Report (Multi-OS)
💡 Full report: Download artifacts from this workflow run. |
…e redundant Sprintf calls Enum constraints for cardinality/dataFlow removed from schema since the generator does not produce them — validation is enforced at the Go model level instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
raifdmueller
left a comment
There was a problem hiding this comment.
Lint fixes applied (fmt.Fprintf pattern), schema regenerated — enum validation remains in Go model validator.
📊 Test Report (Multi-OS)
💡 Full report: Download artifacts from this workflow run. |
…Status Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📊 Test Report (Multi-OS)
💡 Full report: Download artifacts from this workflow run. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📊 Test Report (Multi-OS)
💡 Full report: Download artifacts from this workflow run. |
Fixes #289
Summary
Adds support for cardinality and data flow annotations on relationships, enabling precise communication of integration patterns and data relationship semantics in architecture models.
Changes
Design
Example Usage
{ "relationships": [ { "from": "service1", "to": "service2", "label": "queries database", "cardinality": "1:N", "dataFlow": "sync" }, { "from": "eventBus", "to": "consumers", "cardinality": "1:N", "dataFlow": "publish/subscribe" } ] }Test Plan
🤖 Generated with Claude Code