validateIrForRpc
Import from @varavel/vdl-plugin-sdk/utils/rpc.
Validates IR types annotated for RPC conventions and returns plugin-friendly diagnostics.
This helper enforces the SDK-level RPC structural rules used by RPC-oriented plugins and returns errors in the same shape expected by plugin outputs.
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 non-throwing: it always returns either a diagnostics array or
undefined when no RPC-related issues were found.
Parameters
| Parameter | Type | Description |
|---|---|---|
ir |
IrSchema |
Fully resolved VDL IR schema to validate. |
Returns
| PluginOutputError[]
| undefined
A list of PluginOutputError diagnostics, or undefined when valid.