Skip to content

Allow per-diagram legend labels and visibility #52

Description

@hoangbn

Problem

Archify hardcodes legend entries, so authors cannot make the legend match the diagram.

The data-flow legend always shows:

  • primary data
  • policy / PII
  • async batch
  • data store

These labels appear even when the diagram contains no PII, async processing, or data store.

The lifecycle legend always shows active, waiting, success, and failure. A diagram with no waiting state still shows waiting, while the valid start state has no legend entry.

waiting should remain a lifecycle concept. Authors should be able to hide it from diagrams where it does not apply.

The data store label is also misaligned because it uses y, while the adjacent labels use y + 3.

Repro

1. Default data flow shows all fixed labels

This source has one default flow between two backend nodes. It contains no PII, async batch, emphasis flow, or data store.

{
  "schema_version": 1,
  "diagram_type": "dataflow",
  "meta": { "title": "Default Flow Only" },
  "stages": [{ "label": "Input" }, { "label": "Output" }],
  "nodes": [
    { "id": "input", "type": "backend", "label": "Input", "stage": 0, "row": 0 },
    { "id": "output", "type": "backend", "label": "Output", "stage": 1, "row": 0 }
  ],
  "flows": [
    { "from": "input", "to": "output", "label": "request", "route": "straight" }
  ]
}

The rendered legend still shows primary data, policy / PII, async batch, and data store.

Default-only data flow still shows every fixed legend entry

2. Lifecycle without waiting or failure still shows both

This source uses only start, active, and success.

{
  "schema_version": 1,
  "diagram_type": "lifecycle",
  "meta": { "title": "No Waiting or Failure", "viewBox": [720, 566] },
  "lanes": [{ "id": "main", "label": "Lifecycle" }],
  "states": [
    { "id": "started", "type": "start", "label": "Started", "lane": "main", "col": 0 },
    { "id": "running", "type": "active", "label": "Running", "lane": "main", "col": 1 },
    { "id": "completed", "type": "success", "label": "Completed", "lane": "main", "col": 2 }
  ],
  "transitions": [
    { "from": "started", "to": "running" },
    { "from": "running", "to": "completed" }
  ]
}

The legend shows zero-count waiting and failure / exit entries, but no start entry.

Lifecycle with start, active, and success still shows unused waiting and failure entries

3. A legend override fails schema validation

Adding a legend property under meta:

"meta": {
  "title": "Attempted Legend Override",
  "legend": {
    "security": "restricted data",
    "dashed": "retry"
  }
}

fails with:

/meta must NOT have additional properties {"additionalProperty":"legend"}

Validation rejects a legend override

Evidence

Expected behavior

Allow diagram authors to control which legend entries appear and what they are called.

The current legends can remain as defaults. Authors should be able to:

  • Rename labels such as policy / PII and async batch.
  • Hide entries that do not apply, such as waiting.
  • Show entries the diagram needs, such as start.

All legend labels should use the same baseline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions