Skip to content

generateVdl

Import from @varavel/vdl-plugin-sdk/utils/codegen.

function generateVdl(node, options?): string;

Reconstructs canonical VDL source code from a normalized IR node.

Schema generation sorts top-level nodes by it's source position so the emitted document remains close to the original traversal order even though the IR is stored in separate collections.

When no position information is available, the code is generated following the IR collection order (docs -> types -> enums -> constants) and the original order of nodes within each collection.

Parameters

Parameter Type Description
node GenerateVdlNode Schema or top-level IR node to render.
options GenerateVdlOptions Optional rendering configuration.

Returns

string

Valid VDL source for the provided node.