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

# Validate JSON Schema

> Validate any value against JSON Schema and expose validation results.

The **Validate JSON Schema** action checks workflow data against a JSON Schema.
It returns a boolean and every validation error. For object schemas, it also
creates outputs for the schema's top-level properties.

## Inputs

| Input      | Type   | Required | Description                 |
| ---------- | ------ | -------- | --------------------------- |
| **Data**   | Any    | Yes      | The value to validate.      |
| **Schema** | String | Yes      | A JSON-encoded JSON Schema. |

## Outputs

| Output        | Type            | When shown                    | Description                                    |
| ------------- | --------------- | ----------------------------- | ---------------------------------------------- |
| **Is Valid**  | Boolean         | Always                        | Whether **Data** satisfies the schema.         |
| **Errors**    | List of strings | Always                        | All validation errors; empty when valid.       |
| **Validated** | Varies          | Non-object schemas            | The original data value after validation.      |
| Property name | Varies          | Object schema with properties | The original value of that top-level property. |

The schema editor uses top-level `type` and `properties` to configure the
additional outputs. String, number, integer, boolean, and object properties
receive matching workflow types; arrays and unknown schema types remain
untyped.

## Example: validate a customer

Use this schema:

```json theme={null}
{
  "type": "object",
  "properties": {
    "name": { "type": "string", "minLength": 1 },
    "age": { "type": "integer", "minimum": 18 },
    "active": { "type": "boolean" }
  },
  "required": ["name", "age"],
  "additionalProperties": false
}
```

The node exposes `name`, `age`, and `active` as outputs. For:

```json theme={null}
{
  "name": "Ada",
  "age": 17,
  "active": true
}
```

**Is Valid** is `false`, and **Errors** includes an entry similar to:

```text theme={null}
/age: must be >= 18
```

The property outputs still expose the supplied values, even when validation
fails. Use **Is Valid** to guard any branch that consumes them.

<Warning>
  Validation does not coerce types or remove additional properties. The string
  `"18"` does not satisfy an `integer` schema, and the returned values are the
  original input values.
</Warning>

## Error behavior

Validation failures are normal results: **Is Valid** becomes `false`, and
**Errors** describes every detected problem. By contrast, malformed JSON or an
invalid schema causes the action itself to fail before data can be validated.

<AccordionGroup>
  <Accordion title="The schema editor says Invalid JSON">
    JSON does not allow comments, trailing commas, or single-quoted strings.
    Parse the schema as JSON and try again.
  </Accordion>

  <Accordion title="A required property output is empty">
    The schema defines the output because the property exists under `properties`,
    but the input data did not provide that own top-level key. Check **Is Valid**
    and **Errors** before using the output.
  </Accordion>

  <Accordion title="I see one error but expected several">
    The validator collects all errors it can detect in one pass. Fix the
    reported schema-level or parent-value problem first; additional nested
    checks may only become meaningful afterward.
  </Accordion>
</AccordionGroup>
