OzzyRMOzzyRMDocs
Configuration

Scenarios

Define use-case slices with filtered models, enums, and ERD path highlights.

Scenarios let you document a use-case slice of a schema: which models and enums matter, plus an optional ordered path for ERD highlight simulation. Builders can share flows (billing, issue lifecycle, onboarding) without leaving the docs UI.

Scenarios attach to a catalog version via schemaId. That id is either a standalone source id or a unified[].id.

Example

TypeScript
import { defineProject, prisma, sql } from "ozzyrm";

export default defineProject({
  output: "./.ozzyrm",
  schemas: [
    prisma({ id: "app-prisma", include: ["./prisma"] }),
    sql({ id: "legacy-sql", include: ["./sql/legacy.sql"] }),
  ],
  unified: [
    {
      id: "company-schema",
      sources: ["app-prisma", "legacy-sql"],
      file: "company",
      version: "1.0.0",
    },
  ],
  scenarios: [
    {
      id: "issue-lifecycle",
      label: "Issue lifecycle",
      description:
        "Org owns a project, issues are filed, then discussed via comments.",
      schemaId: "company-schema",
      models: [
        "Organization",
        "Project",
        "Issue",
        "Comment",
        "User",
        "IssueAssignee",
      ],
      enums: ["IssueStatus", "Role"],
      path: ["Organization", "Project", "Issue", "Comment"],
    },
    {
      id: "billing-flow",
      label: "Billing flow",
      description:
        "How invoices hang off an organization down to line items and products.",
      schemaId: "company-schema",
      models: [
        "Organization",
        "BillingAccount",
        "Invoice",
        "InvoiceLine",
        "Product",
        "Price",
        "Subscription",
      ],
      enums: ["InvoiceStatus", "SubscriptionStatus"],
      path: ["Organization", "Invoice", "InvoiceLine", "Product"],
    },
  ],
});

Scenario fields

FieldTypeRequiredNotes
idstringyesKebab-case only (billing-flow). Must be unique
labelstringyesNon-empty display title
schemaIdstringyesCatalog version id (source id or unified id)
modelsstring[]yesAt least one model name that exists on that schema
descriptionstringnoShort summary in the UI
enumsstring[]noEnum names that exist on that schema
pathstring[]noOrdered model names for ERD path highlight

Path rules

When you set path:

  1. Every model in path must exist on the schema
  2. Every model in path must also appear in models (PATH_MODEL_NOT_IN_SCENARIO)
  3. Adjacent hops must have a relation in the graph (PATH_RELATION_MISSING)

The resolved scenario stores pathEdges for the ERD highlight.

Validation (fail closed)

Invalid scenarios reject the whole catalog load with aggregated diagnostics:

CodeWhen
INVALID_SCENARIO_IDMissing id or not kebab-case
DUP_SCENARIO_IDTwo scenarios share the same id
INVALID_SCENARIO_LABELEmpty label
UNKNOWN_SCHEMA_IDschemaId not in the catalog
EMPTY_SCENARIO_MODELSNo valid models
UNKNOWN_MODELModel missing from schema
UNKNOWN_ENUMEnum missing from schema
PATH_MODEL_NOT_IN_SCENARIOPath model not listed in models
PATH_RELATION_MISSINGNo relation between adjacent path models

Scenario config is validated together with unified merge rules. Fix diagnostics before the docs UI can load a fresh catalog.

What you see in the UI

  • Scenario entries appear in the schema sidebar for that catalog version
  • Opening a scenario shows the filtered model set and description
  • The ERD can highlight the path when relations exist between hops

On this page