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

# Schema Validation

> Validate the previous command payload against a named tenant JSON Schema

The Schema Validation command (Command Type: 2) checks that the previous command's payload matches a named JSON Schema stored for your tenant. On success the payload is unchanged and the Blueprint continues. On failure the command throws, the step run counts as **invalid**, and no results from that run reach child steps or sinks.

## Overview

The Schema Validation command provides functionality for:

* Validating the current payload against a named tenant JSON Schema (JSON Schema 2020-12)
* Failing the item as **invalid** when the payload does not match (`incorrect scheme for {name}`)
* Failing the item as **invalid** when the schema is missing at runtime (`scheme not found for {name}`)

## Command Type

**Command Type ID:** 2

## Parameters

| Parameter | Type | Description | Required |
| - | - | - | - |
| **schema** | object | Selected schema. Contains **name** (string) and **id** (UUID). Chosen from the Schema Validation dropdown. | Yes |

## Usage Examples

### Validate payload against a named schema

```json theme={null}
{
  "command": "schema-validation",
  "params": {
    "schema": {
      "name": "ProviderEvent.InPlay",
      "id": "00000000-0000-0000-0000-000000000000"
    }
  }
}
```

Place Schema Validation after parse/transform commands and before a [Sink](https://docs.bringits.com/stream/commands/sink.md) so only contract-compliant payloads are published.

## Failure behavior

| Situation | Result | Typical error |
| - | - | - |
| Payload matches schema | Continues; data unchanged | — |
| Payload does not match | Item **invalid** | `incorrect scheme for {name}` (truncated Ajv path/message) |
| Schema missing at runtime | Item **invalid** | `scheme not found for {name}` |
| Payload is a JSON string that fails to parse | Item **invalid** | Treated as incorrect scheme |

Check [step statistics](https://docs.bringits.com/stream/quickstart/project-monitor.md) and the test panel / item error text when invalid counts rise after a transform or schema edit.

> [!NOTE]
>
> Sandbox uses the same validation path. Ensure the named schema already exists for the tenant, then run the step sandbox with a real sample payload.

## Common Use Cases

* **Contract guard before Sink**: Ensure Kafka / RabbitMQ payloads match an agreed ProviderEvent (or other) shape
* **Catch transform drift**: Fail early when JSONata or mapping output drops required fields
* **Tenant-owned contracts**: Keep one named schema per output type and reuse it across projects

## Related Commands

* [Command Validation](https://docs.bringits.com/stream/commands/validation/command-validation.md) - String include/exclude checks (VALIDATION id 1)
* [JSONata](https://docs.bringits.com/stream/commands/parse/jsonata.md) - Shape the payload before schema validation
* [Kafka Sink](https://docs.bringits.com/stream/commands/sink/kafka-sink.md) - Publish only after validation passes


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