Class JsonDiagnosticReport


public final class JsonDiagnosticReport extends DiagnosticRenderer
Renders a DiagnosticSnapshot as JSON, for tools that consume the diagnostic report programmatically (IDE integrations, CI dashboards).

The document mirrors the human-readable report section for section:

{
  "schemaVersion": 1,
  "source": "examples/foo.jd",
  "status": "ok" | "errors",
  "diagnostics": [ { "severity", "code"?, "source", "line"?, "column"?, "message" } ],
  "stats": { "commands": { "total", "macros" }, "deferrals" },
  "models": [ { "name", "kind", "implements"?, "location",
                "elements": { … }, "usedBy": [ … ],
                "symbols": [ … ], "aliases": [ … ] } ],
  "actions": [ { "index", "depth", "macro", "description" } ]
}

Optional keys are omitted rather than emitted as null: a diagnostic without a code has no code key, and one without a source location has neither line nor column.

The document is described by a strict published JSON Schema, so any change to the set of members — including adding one — means publishing a new schema and incrementing SCHEMA_VERSION. See docs/design/diagnostic-schema.md.

Uses org.json internally as a builder for correct string escaping; the pipeline type remains String, consistent with the other text emitters (ADR-0013).

See Also:
  • Field Details

    • SCHEMA_VERSION

      public static final int SCHEMA_VERSION
      Version of the emitted document shape.
      See Also:
  • Constructor Details

    • JsonDiagnosticReport

      public JsonDiagnosticReport()
  • Method Details