Skip to content

getValidatePluginApiPayloadsDebugSwitch

Gets the debug switch that decides whether a plugin-API call’s payloads are validated against the contract.

Its id is obsidian-lib:validate-plugin-api-payloads and it is off by default. While it is on, every call through a handle from watchPluginApi or findPluginApi checks its arguments and its return value against the method’s declared schemas and throws a PluginApiValidationError on a mismatch. The obsidian-dev-utils:PluginApi debugger does not affect it: that only logs.

The switch is registered on every read, which is idempotent, and whenever an API is published, watched or looked up, so a debug-settings UI lists it as soon as any plugin API is in play.

Import:

import { getValidatePluginApiPayloadsDebugSwitch } from '@mnaoumov/obsidian-lib/plugin/plugin-api';

Signature:

function getValidatePluginApiPayloadsDebugSwitch(): DebugSwitch

Returns: DebugSwitch — The debug switch.


Links to this page: