Skip to content

Save a View

A Saved View is a diagram written into a Project’s files as a query over the Model. Save one when a question comes up often enough to deserve a link, and the Generated Views don’t answer it at a glance. See Views.

Write down who the View is for and what it answers: “what does an Orders DB outage affect?”. That decides its level and selectors. Check first that a Generated View (c1, c2, c2/<system>, c3/<service>, deployment/<environment>) doesn’t already show it.

Open the viewer (archidocs dev), get the screen to answer the question (open what needs opening, turn on a Lens), then use Save as View. It gives you the View as YAML. Or write it by hand.

Paste it under views › structural in the Project’s views.yaml, keyed by an id unique among the Project’s Views:

sink/views.yaml
structural:
everything:
title: Everything
description: Every Element, with Shop and API open.
level: c3
include:
- element: shop
with: descendants
- customer
- search
- payment-gateway
- payments-provider
orders-db-outage:
title: What an Orders DB outage affects
description: The Services that depend on Orders DB, with the Impact Lens on.
level: c2
include:
- element: orders-db
upstream: all
exclude:
- customer
lens:
impact: orders-db
direction: upstream
The Kitchen sink Services that depend on Orders DB, marked by how far upstream they are.The Kitchen sink Services that depend on Orders DB, marked by how far upstream they are.
Open in the live viewer ↗
  • title and level are required.
  • include selects Elements: an id, {element, with, upstream, downstream}, {team}, {tag} or {from, to, paths}. Without it, the View starts from every Element.
  • exclude takes the same selectors and drops what they match.
  • lens opens the View with a Lens on: {impact, direction}, {team} or {path: {from, to}}.

Prefer selectors that follow the Model, such as upstream: all, over lists of ids: a Service added later then joins the View on its own.

Terminal window
archidocs check

A View that resolves to no nodes is reported (empty-view), and so is a View too big to read (oversized-view). Once published, the View’s link is #/view/<project>:<id> in the viewer, and archidocs export draws it as a picture.

upsert_view writes a View, and get_view shows what it resolves to.