setValidation

View as MarkdownOpen in Claude

Toggle verb schema validation at runtime. When validation is enabled (the default), addVerb() validates each verb’s config against the schema and throws if it fails. Disable validation for performance-sensitive call paths or when constructing verbs with custom schemas not known to the built-in schema utilities.

Matches the Python schema_validation constructor parameter on AgentBase. For SWML service validation at construct time, pass schemaValidation: false to the SwmlBuilder constructor via SwmlBuilderOptions.

Parameters

enabled
booleanRequired

true to enable schema validation on subsequent addVerb() calls, false to disable.

Returns

void

Example

1import { SwmlBuilder } from '@signalwire/sdk';
2
3const builder = new SwmlBuilder();
4
5// Validation on (default) — throws on invalid verb
6builder.answer();
7
8// Disable validation for a hot path
9builder.setValidation(false);
10builder.addVerb('custom_verb', { unusual: 'payload' });