For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
        • AuthHandler
        • ConfigLoader
        • Environment Variables
        • Logging
        • PromptManager
        • SchemaUtils
          • clearCache
          • getCacheSize
          • getVerbDescription
          • getVerbNames
          • getVerbProperties
          • getVerbRequiredProperties
          • hasVerb
          • validate
          • validateVerb
        • ServerlessAdapter
        • SessionManager
        • SslConfig
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Constructor
  • Methods
  • Example
AgentsConfiguration

SchemaUtils

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

clearCache

Next
Built with

SchemaUtils validates SWML documents against structural rules and provides schema-driven verb extraction and validation. Results are cached with an LRU-style eviction policy. Set SWML_SKIP_SCHEMA_VALIDATION=true to disable validation globally.

1import { SchemaUtils } from '@signalwire/sdk';
2
3const schema = new SchemaUtils();
4const result = schema.validate(swmlDocument);
5console.log(result.valid, result.errors);

Constructor

opts
object

Optional constructor configuration.

opts.skipValidation
boolean

Skip all validation checks. When omitted, defaults to true if the SWML_SKIP_SCHEMA_VALIDATION environment variable is "true", otherwise false.

opts.maxCacheSize
numberDefaults to 100

Maximum number of cached validation results before LRU eviction.

opts.schemaPath
string

Path to a custom JSON Schema file. When omitted, the bundled schema.json is used. Mirrors the Python SDK’s schema_path parameter. A load failure falls back to the bundled schema silently.

Methods

getVerbNames

Get all verb names defined in the SWML schema.

getVerbProperties

Get the inner properties schema for a specific verb.

getVerbRequiredProperties

Get the required properties for a verb.

getVerbDescription

Get the description text for a verb.

hasVerb

Check if a verb name exists in the schema.

validateVerb

Lightweight validation of a verb config against the schema.

validate

Validate a SWML document against structural rules.

clearCache

Clear the validation result cache.

getCacheSize

Get the number of cached validation results.

Example

1import { SchemaUtils } from '@signalwire/sdk';
2
3const schema = new SchemaUtils();
4
5// Validate a SWML document
6const result = schema.validate({
7 version: '1.0.0',
8 sections: { main: [{ answer: {} }, { hangup: {} }] },
9});
10console.log(result.valid); // true
11console.log(result.errors); // []