Skip to content

Write a Dynamic View

Write a Dynamic View, one scenario as numbered Steps, so readers can follow a flow such as “a customer signs in” as a sequence chart.

  • Every call in the scenario is a Relationship in the Model. See Connect Services. Views says why a Step must follow one.

Start from who or what begins it, and follow the Relationships. In the viewer, the Element panel lists each Element’s Relationships, and the Connect to… Lens shows the paths between two Elements. Where a call happens but the Model has no Relationship for it, add the Relationship first.

Add the View under views › dynamic in a Project’s views.yaml. Each Step is a call, a reply with return: true, or an event from a Publisher to a Subscriber:

digital/views.yaml
sign-in:
title: Customer signs in
steps:
- from: customer
to: spa
description: Enters username and password
- from: spa
to: sign-in-controller
description: POST /api/sign-in
- from: sign-in-controller
to: security-component
description: Checks the session
- from: security-component
to: identity:auth-service
description: Validates the token
- from: identity:auth-service
to: security-component
return: true
description: Token valid
- from: sign-in-controller
to: spa
return: true
description: Session cookie

An event is drawn the way it travels, from the Publisher, though its Relationship points the other way. To fix the order of the lifelines, list them in participants. Every field of a Step is in the Saved Views reference.

Terminal window
archidocs check
0 errors, 0 warnings

In the viewer, open the View from the Views tree. It opens as a sequence chart, with its Steps listed beside it:

A Big Bank customer signs in: the Single-Page Application, the Sign In Controller and the Security Component validate a token with the Auth Service, and the replies come back.A Big Bank customer signs in: the Single-Page Application, the Sign In Controller and the Security Component validate a token with the Auth Service, and the replies come back.
Open in the live viewer ↗

Select a Step to follow it.

A Step needs a Relationship to follow. A reply written as a call has none:

shop/views.yaml · fails check: missing-step
views:
dynamic:
place-order:
title: Place an order
steps:
- from: web
to: api
description: POST /orders
- from: api
to: web
description: Order placed
archidocs/shop/views.yaml:9:11 error missing-step No Relationship from "shop:api" to "shop:web", nor a `via` subscription of "shop:web" to it
1 error, 0 warnings
Rule docs:
missing-step https://archidocs.dev/docs/reference/rules/missing-step/

That is missing-step. The second Step is the reply to the first, so add return: true to it.

check reports ambiguous-step when two Relationships connect the same pair. Name one with relationship: <id>.

upsert_view writes a Dynamic View when its definition has steps. find_paths helps trace one.

Documents the beta branch at cd98671, ahead of the latest release, v1.4.0.