Skip to content

Function: validate() ​

ts
function validate(data, layout, registry, options?): Issue[];

Validate a figure and return every issue found (empty when valid).

Parameters ​

ParameterTypeDescription
dataunknownThe data array (anything; non-arrays are reported).
layoutunknownThe layout object.
registryRegistrySupplies trace schemas, the merged layout schema and template names.
optionsValidateOptionsOptional config (validated against the config schema) and datasets (so '@column' references are resolved before checking, plan E1.6).

Returns ​

Issue[]

Example ​

ts
validate([{ type: 'scatter', mode: 'line' }], {}, registry);
// [{ path: 'data[0].mode', message: "invalid value 'line'; expected any combination of …" }]

Released under the MIT License.