Class JsonDiagnosticReport
java.lang.Object
ca.mcscert.jpipe.compiler.model.Transformation<DiagnosticSnapshot, String>
ca.mcscert.jpipe.compiler.steps.transformations.DiagnosticRenderer
ca.mcscert.jpipe.compiler.steps.transformations.JsonDiagnosticReport
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class Transformation
Transformation.Step<I,O> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intVersion of the emitted document shape.Fields inherited from class Transformation
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrender(DiagnosticSnapshot input) Renders a snapshot into the report text.Methods inherited from class DiagnosticRenderer
run
-
Field Details
-
SCHEMA_VERSION
public static final int SCHEMA_VERSIONVersion of the emitted document shape.- See Also:
-
-
Constructor Details
-
JsonDiagnosticReport
public JsonDiagnosticReport()
-
-
Method Details
-
render
Description copied from class:DiagnosticRendererRenders a snapshot into the report text.- Specified by:
renderin classDiagnosticRenderer- Parameters:
input- what the compilation produced and reported.- Returns:
- the rendered report.
-