assertValidIrForRpc
Import from @varavel/vdl-plugin-sdk/utils/rpc.
Asserts that RPC-annotated IR structures follow SDK RPC conventions.
This helper is intended for RPC-oriented plugins that want a single fail-fast validation call before generation starts.
Validation rules:
- If no type is annotated with
@rpc, validation is skipped. - Every
@rpctype must be an object type. - Inside each
@rpcobject, only fields annotated with@procor@streamare validated as RPC operations. - An operation field cannot have both
@procand@stream. - Every
@procor@streamfield must be an object type. - If an operation declares
inputoroutputfields, each one must be an object type. - The contents inside valid
input/outputobjects are intentionally not validated by this helper and can be anything.
The function is fail-fast and non-returning for invalid input:
- It returns
voidwhen RPC structures are valid. - It throws
PluginErroron the first violation. definePlugincatches that error and turns it into plugin diagnostics.
Parameters
| Parameter | Type | Description |
|---|---|---|
ir |
IrSchema |
Fully resolved VDL IR schema to validate. |
Returns
void