> ## Documentation Index
> Fetch the complete documentation index at: https://docs.platform.toloka.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# validate

> Assert that a value satisfies the SDK's pipeline graph contract.

```ts theme={null}
import type { PipelineGraphV1 } from "@toloka-platform/sdk";

declare function validate(graph: unknown): asserts graph is PipelineGraphV1;
```

## Parameters

**graph** `unknown` *required*

A graph value to check against the version 1 graph schema and supported entity rules. Pass a graph, not the enclosing `PipelineDefinition` object.

## Returns

**return value** `void`

No value. When validation succeeds, TypeScript narrows `graph` to `PipelineGraphV1`. The function makes no platform request.

## Throws

**error** `PipelineGraphValidationError`

Thrown when graph-schema or supported-entity validation fails.

**Error properties**

**code** `'invalid_pipeline_graph'`

Stable local error code.

**issues** `readonly \{ path: string; reason: string \}[]`

Paths to invalid values and the reason for each failure.

**message** `string`

Starts with `Pipeline graph validation failed`, followed by issue details.

The check covers the graph structure, supported entity types, and allowed-label requirements. It does not establish live project access, secret availability, passed platform checks, or readiness to run. [`toloka check` and platform validation](https://docs.platform.toloka.ai/docs/sdk/pipelines#check-plan-and-apply) cover additional constraints.

Use `validatePipelineDefinition(value)` to validate an authored definition. Use `resolvePipelineDefinition(definition, { datasetId })` to bind a dataset ID and validate the resulting graph. Both are public exports that call `validate` internally.

```ts theme={null}
import { readFile } from "node:fs/promises";
import { PipelineGraphValidationError, validate } from "@toloka-platform/sdk";

const graph: unknown = JSON.parse(await readFile("graph.json", "utf8"));

try {
  validate(graph);
  console.log("Graph version:", graph.version);
} catch (error) {
  if (!(error instanceof PipelineGraphValidationError)) throw error;
  for (const issue of error.issues) {
    console.error(issue.path, issue.reason);
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.