Govern

Tags

Cross-artifact taxonomy for charts, dashboards, notebooks, saved queries, and glossary terms. Shared validation rules, the /api/tags aggregation endpoint, and the ?tag= URL filter.

What this page does for you

Tags are the lightweight cross-artifact taxonomy Goni surfaces on every user-authored object. One tag string means the same thing whether it hangs off a chart, a dashboard, a notebook, a saved query, or a glossary term - the same validation runs on every write path, the same normalization runs on every read, and the same URL filter jumps a user from a tag chip to a filtered list.

You’ll learn:

  • The five tag surfaces (Chart, Dashboard, Notebook, SavedQuery, Glossary) and what “shared” actually means.
  • The tag validation rules the server enforces, and the normalization the client applies before submit.
  • How the /api/tags aggregation endpoint returns per-kind counts for the Tags index page.
  • How the ?tag=<name> URL parameter seeds an active filter on every artifact list page.

Validation rules

Tag strings are validated by a single shared helper inside bi-api, and every write path routes through it. The rules are deliberately narrow so a tag renders identically in a URL, a JSON payload, a CLI, and a filesystem-backed store:

  • Character set: lowercase letters a-z, digits 0-9, hyphen -, and underscore _. Anything else is rejected with a 400.
  • Length: 1 to 32 characters inclusive.
  • First character: must be alphanumeric. A leading - or _ is rejected. This mirrors Goni’s workspace-id convention so a tag finance and a workspace finance can share a URL slug shape without escaping.
  • Cap per artifact: 32 tags. Redash-shaped systems ship with ~20; Goni leaves headroom without turning the sidebar into a wall of chips. A submission that exceeds the cap is rejected with too many tags (max 32).

The regex the server compiles is ^[a-z0-9][a-z0-9_\-]{0,31}$. A tag that fails the regex is rejected with tag[i] "raw" invalid (lowercase letters/digits/_/- only, max 32, start alnum) where i is the offending index in the submitted array.

Normalization

Every write path also normalises before validation, so a tag typed with a stray uppercase letter or a padding space is accepted and stored in canonical form rather than rejected outright:

  • Leading and trailing whitespace is trimmed.
  • The string is lowercased.
  • Empty strings after trim are dropped (an all-whitespace tag disappears rather than 400ing the whole request).
  • Duplicates after lowercasing are removed. Since we lowercase first, this is effectively case-insensitive dedup.

The returned canonical slice is what gets persisted. Callers should overwrite their user-supplied slice with the server response when they want to keep the client display in sync with what the server actually stored.

Client-side, the SPA runs the same normalization before it submits so the “what will happen” preview matches the server’s actual behaviour. The server is still the authority: a client that skips normalization gets exactly the same 400 response as one that submits garbage directly.

The /api/tags aggregation endpoint

The Tags index page needs one number per kind per tag: how many charts, dashboards, notebooks, saved queries, and glossary terms carry this tag across every workspace the caller can see. /api/tags returns exactly that shape and takes no query parameters - scope is derived from the caller’s session:

GET /api/tags

Response body:

{
  "tags": [
    { "name": "finance", "count": 7, "kinds": [{ "chart": 4, "dashboard": 2, "query": 1 }] },
    { "name": "exec",    "count": 4, "kinds": [{ "chart": 1, "dashboard": 3 }] }
  ]
}

Each entry carries:

  • name - the canonical (lowercased, trimmed) tag string.
  • count - the total number of artifacts (across all five kinds) that carry the tag.
  • kinds - a one-element array whose only element is a map from artifact kind to occurrence count. Kinds with a zero count are omitted from the map rather than set to 0. The single-element outer array is a forward-compatible shape: future per-workspace breakouts can add elements without a breaking rename.

Kind keys are chart, dashboard, notebook, query, and glossary.

Scoping and RBAC:

  • The endpoint requires authentication. Anonymous callers get a 401 with the message “/api/tags requires authentication”.
  • Every artifact is filtered through canAccessWorkspace(workspace_id) on the caller’s session before its tags are folded in, so a tag that only hangs off objects in workspaces the caller cannot see does not appear. canAccessWorkspace() is the enforcement primitive that gates access to workspace-pinned artifacts - see Access control - Workspaces and membership.
  • Aggregation is server-side so the Tags page does not fan out to five list endpoints and re-compute counts in the browser on every visit.

Response ordering is deterministic: highest count first, tie-broken by name ascending. This keeps snapshot tests stable and matches what a user expects when reading the Tags index top-to-bottom.

For the full REST reference of this endpoint (auth, errors, examples) see Audit and Tags API - GET /api/tags.

Tag surfaces

Five artifact kinds carry tags today:

  • Chart - the chart’s YAML metadata carries a tags array; the Chart Studio surfaces a chip editor next to the title.
  • Dashboard - the dashboard document carries a tags array; the dashboard header shows the chips inline with the title.
  • Notebook - the notebook document carries a tags array; the notebook editor surfaces chips beside the notebook name.
  • SavedQuery - a saved SQL query carries a tags array; the SQL IDE’s Queries panel shows chips next to each query name.
  • Glossary - a glossary term carries a tags array so a business term can share the same taxonomy the analytical objects use.

All five write paths route through the shared validateTags helper, so a tag string that is valid on a chart is valid on a glossary term, and vice versa. There is no per-kind tag scope; the vocabulary is shared across the workspace.

The ?tag= URL filter

Every artifact list page recognises ?tag=<name> and seeds its active-tag filter from that parameter. This turns a tag chip into a shareable link: paste /charts?tag=finance into Slack and the recipient lands on the Charts list filtered to finance without any extra clicks.

The seed happens on mount via useTagQueryParam; the filter can still be cleared or changed from the page’s own filter bar. The URL is not rewritten as the user changes the filter interactively - the parameter is a one-shot seed, not a two-way binding. This keeps the browser back button doing what a user expects (return to the previous page) rather than replaying every filter toggle.

The Tags index page emits ?tag=<name> links directly:

/charts?tag=finance
/dashboards?tag=finance
/notebooks?tag=finance
/ide?tag=finance

Each chip’s href is encodeURIComponent’d, so a tag with a hyphen or underscore round-trips through the URL cleanly.

  • Access control - workspace scoping is how the tag aggregation stays tenant-safe.
  • SQL IDE - the saved-queries panel that surfaces tag chips next to each query.
  • Dashboards - where dashboard tag chips render alongside the title.
  • Audit and Tags API - endpoint-level reference for GET /api/tags and GET /api/audit.
  • REST API - the full endpoint catalog and auth modes.

Last updated