core
Type Aliases
Annotation
Annotation Annotation metadata preserved in IR.
name is the annotation identifier without the @ prefix.
argument, when present, is fully resolved as a LiteralValue.
Properties
argument?
name
position
ConstantDef
ConstantDef Fully resolved constant definition.
typeRef is explicit or inferred by analysis.
value contains the fully resolved literal payload.
Properties
annotations
doc?
name
position
typeRef
value
EnumDef
EnumDef Flattened enum definition.
All enum spreads are already expanded into members.
Properties
annotations
doc?
enumType
members
name
position
EnumMember
EnumMember Enum member definition
Properties
annotations
doc?
name
position
value
EnumValueType
Underlying storage kind used by an enum
Field
Field Flattened object/type field definition
Properties
annotations
doc?
name
optional
position
typeRef
IrSchema
IrSchema IrSchema is the generator-facing representation of a VDL program.
This model is intentionally "flat" and "resolved":
- spreads are already expanded
- references are already resolved
- collections are in deterministic order
A code generator should be able to consume IrSchema directly, without needing to re-run parser or semantic-analysis logic.
Properties
constants
docs
entryPoint
enums
types
LiteralKind
Kind discriminator for LiteralValue.
LiteralValue is used for fully resolved literal data in:
- constant values
- annotation arguments
LiteralValue
LiteralValue Fully resolved literal value.
The selected payload is determined by kind:
string->stringValueint->intValuefloat->floatValuebool->boolValueobject->objectEntriesarray->arrayItems
Properties
arrayItems?
boolValue?
floatValue?
intValue?
kind
objectEntries?
position
stringValue?
ObjectEntry
ObjectEntry Key/value pair inside an object LiteralValue payload
Properties
key
position
value
PluginInput
PluginInput PluginInput represents the data payload sent to a plugin.
The plugin receives this as a single argument containing the complete
Intermediate Representation of the VDL schema along with any user-defined
configuration options from vdl.config.vdl.
Properties
ir
options
version
PluginOutput
PluginOutput PluginOutput represents the response payload returned by the plugin function.
After processing the input schema, the plugin outputs this object containing all files to be generated or errors to be displayed to the user.
If there are no errors and at least one file is returned, VDL will write each file to the specified path within the output directory. If there are errors, VDL will display them to the user and not write any files.
Properties
errors?
files?
PluginOutputError
PluginOutputError A structured error reported by the plugin.
Properties
message
position?
PluginOutputFile
PluginOutputFile PluginOutputFile represents a single generated file produced by the plugin.
This abstraction allows plugins to generate multiple files from a single invocation, enabling patterns like one-file-per-type or splitting large outputs across multiple modules.
Properties
content
path
Position
Position It represents a position within a file and is used for error reporting, diagnostics, plugins, and tooling support.
Properties
column
file
line
PrimitiveType
Primitive scalar type names
TopLevelDoc
TopLevelDoc Standalone documentation block.
Used for top-level docstrings that are not attached to a type/enum/constant.
Properties
content
position
TypeDef
TypeDef Flattened type definition.
All spreads are already expanded. The unified typeRef describes what this
type IS, a primitive, custom reference, map, array, or object with fields.
Properties
annotations
doc?
name
position
typeRef
TypeKind
Kind discriminator for TypeRef
TypeRef
TypeRef Normalized type reference used by fields and constants.
kind selects which payload fields are meaningful. Generators should inspect
kind first, then read the related payload fields.
Properties
arrayDims?
arrayType?
enumName?
enumType?
kind
mapType?
objectFields?
primitiveName?
typeName?
VdlPluginHandler()
Function signature implemented by every VDL plugin entry point.
The handler receives the typed plugin input produced by VDL and returns the generated files and any diagnostics for the current run.
Parameters
input
The plugin invocation context, including version, options, and IR.
Returns
The files and errors produced by the plugin.
Example
const generate: VdlPluginHandler = (input) => {
return {
files: [{ path: "hello.txt", content: input.version }],
};
};
Variables
EnumValueTypeList
LiteralKindList
PrimitiveTypeList
TypeKindList
Functions
definePlugin()
Wraps a plugin handler so it can be exported as the canonical VDL entry point.
definePlugin is intentionally minimal. It preserves the handler's type
information and gives plugin projects a single, explicit pattern for exporting
generate from src/index.ts.
Parameters
handler
The plugin implementation to expose as the runtime entry point.
Returns
The same handler function, unchanged.
Example
import { definePlugin } from "@varavel/vdl-plugin-sdk";
export const generate = definePlugin((input) => {
return {
files: [
{
path: "schema-summary.txt",
content: `VDL ${input.version}`,
},
],
};
});
hydrateAnnotation()
Parameters
input
Returns
hydrateConstantDef()
Parameters
input
Returns
hydrateEnumDef()
Parameters
input
Returns
hydrateEnumMember()
Parameters
input
Returns
hydrateField()
Parameters
input
Returns
hydrateIrSchema()
Parameters
input
Returns
hydrateLiteralValue()
Parameters
input
Returns
hydrateObjectEntry()
Parameters
input
Returns
hydratePluginInput()
Parameters
input
Returns
hydratePluginOutput()
Parameters
input
Returns
hydratePluginOutputError()
Parameters
input
Returns
hydratePluginOutputFile()
Parameters
input
Returns
hydratePosition()
Parameters
input
Returns
hydrateTopLevelDoc()
Parameters
input
Returns
hydrateTypeDef()
Parameters
input
Returns
hydrateTypeRef()
Parameters
input
Returns
isEnumValueType()
Parameters
value
unknown
Returns
value is EnumValueType
isLiteralKind()
Parameters
value
unknown
Returns
value is LiteralKind
isPrimitiveType()
Parameters
value
unknown
Returns
value is PrimitiveType
isTypeKind()
Parameters
value
unknown
Returns
value is TypeKind
validateAnnotation()
Parameters
input
unknown
path?
string = "Annotation"
Returns
string | null
validateConstantDef()
Parameters
input
unknown
path?
string = "ConstantDef"
Returns
string | null
validateEnumDef()
Parameters
input
unknown
path?
string = "EnumDef"
Returns
string | null
validateEnumMember()
Parameters
input
unknown
path?
string = "EnumMember"
Returns
string | null
validateField()
Parameters
input
unknown
path?
string = "Field"
Returns
string | null
validateIrSchema()
Parameters
input
unknown
path?
string = "IrSchema"
Returns
string | null
validateLiteralValue()
Parameters
input
unknown
path?
string = "LiteralValue"
Returns
string | null
validateObjectEntry()
Parameters
input
unknown
path?
string = "ObjectEntry"
Returns
string | null
validatePluginInput()
Parameters
input
unknown
path?
string = "PluginInput"
Returns
string | null
validatePluginOutput()
Parameters
input
unknown
path?
string = "PluginOutput"
Returns
string | null
validatePluginOutputError()
Parameters
input
unknown
path?
string = "PluginOutputError"
Returns
string | null
validatePluginOutputFile()
Parameters
_input
unknown
_path?
string = "PluginOutputFile"
Returns
string | null
validatePosition()
Parameters
_input
unknown
_path?
string = "Position"
Returns
string | null
validateTopLevelDoc()
Parameters
input
unknown
path?
string = "TopLevelDoc"
Returns
string | null
validateTypeDef()
Parameters
input
unknown
path?
string = "TypeDef"
Returns
string | null
validateTypeRef()
Parameters
input
unknown
path?
string = "TypeRef"
Returns
string | null