Skip to content

Commit edfa7a4

Browse files
committed
docs: replace text diagrams with mermaid sequences
1 parent 569aba4 commit edfa7a4

File tree

1 file changed

+54
-16
lines changed

1 file changed

+54
-16
lines changed

Docs/validation-flow.md

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,39 @@ Client -> API Controller -> (Model Binding) -> Request DTO -> Command Mapping ->
3434

3535
### Sequence Diagram
3636

37-
```text
38-
+---------+ +-----------------+ +----------------+ +-------------------+
39-
| Client | ---> | OrdersController| ---> | OrderService | ---> | Dataverse Adapter |
40-
+---------+ +-----------------+ +----------------+ +-------------------+
41-
HTTP POST /api/orders | |
42-
| CreateOrderAsync |
43-
| - Map DTO -> Command |
44-
| - Call validator |
45-
| - Throw on failure |
46-
v |
47-
Shared Validator |
48-
| (IOrderRulesData impl) |
49-
v v
50-
(If valid) Dataverse create (plugin will validate again)
37+
```mermaid
38+
sequenceDiagram
39+
autonumber
40+
participant C as Client
41+
participant AC as API Controller
42+
participant S as OrderService
43+
participant V as CreateOrderValidator
44+
participant D as Dataverse
45+
participant P as Plugin (PreValidation)
46+
47+
C->>AC: POST /api/orders (JSON)
48+
AC->>S: CreateOrderAsync(command)
49+
S->>V: ValidateAsync(command)
50+
V-->>S: ValidationResult (valid?)
51+
alt Invalid
52+
V-->>AC: Errors
53+
AC-->>C: 400 ValidationProblemDetails
54+
else Valid
55+
S->>D: Create order
56+
D->>P: Invoke Plugin Pipeline
57+
P->>V: Re-run validation (authoritative)
58+
V-->>P: Result
59+
alt Plugin invalid
60+
P-->>D: Throw InvalidPluginExecutionException
61+
D-->>S: Abort transaction
62+
S-->>AC: Error propagated
63+
AC-->>C: 400/Failure
64+
else Plugin valid
65+
D-->>S: OrderId
66+
S-->>AC: OrderResponse
67+
AC-->>C: 201 Created
68+
end
69+
end
5170
```
5271

5372
Controller excerpt (simplified):
@@ -98,8 +117,27 @@ if(!result.IsValid)
98117

99118
Where it sits in the pipeline:
100119

101-
```text
102-
User / Integration -> Dataverse Platform -> (PreValidation Plugin) -> Transaction continues if valid -> Core Operation (DB write) -> PostOperation plugins
120+
```mermaid
121+
sequenceDiagram
122+
autonumber
123+
participant U as User / Client
124+
participant DP as Dataverse Platform
125+
participant PV as PreValidation Plugin
126+
participant CO as Core Operation
127+
participant PO as PostOperation Plugins
128+
U->>DP: Create Request
129+
DP->>PV: Invoke PreValidation stage
130+
PV->>PV: Map & Validate (CreateOrderValidator)
131+
alt Invalid
132+
PV-->>DP: Throw InvalidPluginExecutionException
133+
DP-->>U: Error (validation details)
134+
else Valid
135+
PV-->>DP: Continue
136+
DP->>CO: Perform DB write
137+
CO-->>PO: Invoke PostOperation
138+
PO-->>DP: Optional post-processing
139+
DP-->>U: Success (OrderId)
140+
end
103141
```
104142

105143
Plugin role:

0 commit comments

Comments
 (0)