> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # SchemaUtils > SWML document validation against structural rules with an LRU-style result cache. `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. ```typescript {3} import { SchemaUtils } from '@signalwire/sdk'; const schema = new SchemaUtils(); const result = schema.validate(swmlDocument); console.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`** `number` — default: 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](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-names) Get all verb names defined in the SWML schema. #### [getVerbProperties](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-properties) Get the inner properties schema for a specific verb. #### [getVerbRequiredProperties](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-required-properties) Get the required properties for a verb. #### [getVerbDescription](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-description) Get the description text for a verb. #### [hasVerb](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/has-verb) Check if a verb name exists in the schema. #### [validateVerb](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/validate-verb) Lightweight validation of a verb config against the schema. #### [validate](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/validate) Validate a SWML document against structural rules. #### [clearCache](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/clear-cache) Clear the validation result cache. #### [getCacheSize](/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-cache-size) Get the number of cached validation results. ## **Example** ```typescript {3,5-9} import { SchemaUtils } from '@signalwire/sdk'; const schema = new SchemaUtils(); // Validate a SWML document const result = schema.validate({ version: '1.0.0', sections: { main: [{ answer: {} }, { hangup: {} }] }, }); console.log(result.valid); // true console.log(result.errors); // [] ``` > SWML document validation against structural rules with an LRU-style result cache. ## Docs - [clearCache](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/clear-cache.md): Clear the validation result cache. - [getCacheSize](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-cache-size.md): Get the number of cached validation results. - [getVerbDescription](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-description.md): Get the description text for a verb. - [getVerbNames](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-names.md): Get all verb names defined in the SWML schema. - [getVerbProperties](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-properties.md): Get the inner properties schema for a specific verb. - [getVerbRequiredProperties](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/get-verb-required-properties.md): Get the required properties for a verb. - [hasVerb](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/has-verb.md): Check if a verb name exists in the schema. - [validate](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/validate.md): Validate a SWML document against structural rules. - [validateVerb](https://signalwire.com/docs/server-sdks/reference/typescript/agents/configuration/schema-utils/validate-verb.md): Lightweight validation of a verb config against the schema.