Class ConsoleTemplateValidator

java.lang.Object
org.apache.juneau.console.freemarker.ConsoleTemplateValidator

public final class ConsoleTemplateValidator extends Object
Static lint for console FreeMarker templates. Scans each template for console directive calls and reports unknown directives, unknown attributes, dangling template references, duplicate nav and card ids, non-strict booleans, removed card types and globals, a chart card whose ECharts WebJar is missing (E-70), and a wrong <@main/> count, without rendering any page.

The attribute sets are the same ones the directives enforce at render time. Interpolated values (visible="${x}") and unquoted expressions (visible=flag) are skipped; the render-time errors cover them. Macros defined in the template, in literally <#include>d templates and in the chrome template are in scope, as are <@ns.x> calls on an <#import … as ns> namespace.

Example:

@Test void templatesLint() { List<ConsoleTemplateValidator.Finding> f = ConsoleTemplateValidator.create() .templateRoot(Paths.get("src/main/resources/templates")) .chromeTemplate("base.ftlh") .allowDirective("pageHero") .validateAll(); assertTrue(f.isEmpty(), f::toString); }

Since:
10.0.0