Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / validateEmailTemplate

Function: validateEmailTemplate()

validateEmailTemplate(input): RcmlDocument

Defined in: rcml/src/email/validate-email-template.ts:133

Validate an AI-generated RCML email template against the RCML schema.

Accepts either an RcmlDocument JSON AST or an RCML XML string. XML is parsed first; the resulting tree is then validated structurally, attribute-wise, and for embedded ProseMirror content. LLMs should feed the structured errors list on the thrown error back into their next iteration.

Parameters

input

string | RcmlDocument

JSON AST or RCML XML string.

Returns

RcmlDocument

The validated document narrowed to RcmlDocument.

Throws

When one or more issues are found.