Skip to content

Commit 5e20eab

Browse files
authored
Extend Validation for Component vs Sequence Diagrams (#245)
1 parent b98d44c commit 5e20eab

1 file changed

Lines changed: 64 additions & 8 deletions

File tree

validation/core/docs/specifications/component_sequence.md

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,30 @@
1515

1616
## Purpose
1717

18-
Define the intended consistency rules between component-diagram units and the
19-
participants observed in sequence diagrams.
18+
Define the intended consistency rules between component-diagram units, the
19+
participants observed in sequence diagrams, and the internal interfaces used by
20+
sequence-diagram function calls.
2021

21-
This validator checks whether unit aliases from component diagrams match the
22-
set of used participants collected from sequence diagrams.
22+
This validator checks whether:
23+
24+
- unit aliases from component diagrams match the set of used participants
25+
collected from sequence diagrams
26+
- each function used in a sequence interaction is declared in an interface
27+
associated with the caller and callee unit and available in the related
28+
internal API diagram
2329

2430
## What is Validated
2531

2632
Component-diagram units and sequence-diagram participants must match. The validator checks:
2733

2834
- unit aliases from the component diagram vs. participant aliases used in sequence diagrams
2935
- matching is case-sensitive
36+
- interface connections in the static component diagram vs. function-call
37+
connections between the corresponding units in sequence diagrams
38+
- units connected by function calls in sequence diagrams vs. corresponding
39+
interface connections in the static component diagram
40+
- sequence function names used in interactions vs. method names declared in
41+
interfaces referenced by the participating units in the component diagram
3042

3143
## Failure Cases
3244

@@ -35,36 +47,80 @@ Component-diagram units and sequence-diagram participants must match. The valida
3547
Validation fails when a unit alias defined in the component diagram does not
3648
appear among the participants used in the sequence diagrams.
3749

50+
### Missing sequence interaction for interface-connected units
51+
52+
Validation fails when units are connected through an interface in the static
53+
component diagram, but no corresponding function-call interaction between those
54+
units is specified in the sequence diagram.
55+
3856
### Unexpected sequence participant
3957

4058
Validation fails when a sequence diagram uses a participant alias that does not
4159
correspond to any unit alias declared in the component diagram.
4260

61+
### Missing unit interface relation
62+
63+
Validation fails when the caller unit or callee unit has no related interface
64+
available for function-call validation.
65+
66+
### Missing internal API interface
67+
68+
Validation fails when an interface referenced by the caller or callee unit
69+
cannot be found in the corresponding internal API diagram.
70+
71+
### Method not found in related interfaces
72+
73+
Validation fails when a function used in a sequence interaction is not declared
74+
in the related interfaces defined for the caller and callee units.
75+
76+
The validator reports an error when any of the following applies:
77+
78+
- the function is declared only in interfaces related to the caller unit
79+
- the function is declared only in interfaces related to the callee unit
80+
- the function is declared on both sides, but not in a shared matching
81+
interface
82+
- the function is not declared in any related interface
83+
4384
## Debug Output
4485

45-
The validator emits a debug view containing:
86+
The validator emits debug output containing:
4687

4788
- expected unit aliases
4889
- observed caller/callee participants
90+
- observed sequence calls (`caller -> callee : method`)
91+
- caller and callee interface targets derived from the component diagram
92+
- interfaces checked in the internal API diagram
4993

5094
## Example
5195

5296
If the component diagram defines the unit aliases `unit_1` and `unit_2`, then
53-
the sequence diagrams must use the same participant aliases.
97+
the sequence diagrams must use the same participant aliases. In addition, a
98+
function call such as `unit_1 -> unit_2 : GetData(...)` must be backed by an
99+
interface referenced by `unit_1` and `unit_2` in the component diagram, and
100+
that interface must declare a `GetData` method in the internal API diagram.
54101

55102
```plantuml
56103
' component diagram
57104
package "Package A" as package_a <<SEooC>> {
58105
component "Component A" as component_a <<component>> {
59106
component "Unit 1" as unit_1 <<unit>>
60107
component "Unit 2" as unit_2 <<unit>>
108+
109+
interface "InternalInterface" as InternalInterface
110+
unit_1 --( InternalInterface
111+
unit_2 )-- InternalInterface
61112
}
62113
}
63114
64115
' sequence diagram
65116
participant "Unit 1" as unit_1
66117
participant "Unit 2" as unit_2
67118
68-
unit_1 -> unit_2 : SendSignal
69-
unit_2 --> unit_1 : Ack
119+
unit_1 -> unit_2 : GetData()
120+
unit_2 --> unit_1 : return : Data*
121+
122+
' internal_api diagram
123+
interface "InternalInterface" as InternalInterface <<interface>>{
124+
{abstract} GetData(): Data*
125+
}
70126
```

0 commit comments

Comments
 (0)