YAML Schema Validator

Define a YAML or JSON Schema contract and validate your target YAML data payload in real time.

How to Validate YAML Against a Schema

1

Provide Schema Definition

Paste a valid YAML or JSON Schema definition into the left editor or click Sample Schema.

2

Provide Target Data

Paste your YAML payload into the right editor, click Upload Data, or click Sample Data.

3

Live Verification

Structural schema validation and path diagnostics execute automatically in real time as you edit or upload.

Tool Options

YAML & JSON Dual Syntax

Supports defining JSON Schema contracts natively using clean YAML syntax or traditional JSON formatting.

AJV High-Performance Engine

Powered by AJV to enforce required fields, type assertions, regex patterns, enum values, and numeric ranges.

Comprehensive Path Tracing

Reports exact JSON-pointer data paths (`/properties/replicas`) and precise constraint violation details.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the YAML Schema Validator do?

The YAML Schema Validator on blueutils.com checks YAML data structures and configuration files against JSON Schema specifications (Draft-07 / Draft-04). Powered by AJV, it validates data types, required attributes, regular expression string patterns, enumerations, numeric ranges, and array limits, providing JSON pointer error locations for non-compliant properties.

Core Concepts

Understanding YAML schema validation rules helps verify configuration integrity:

  • Schema Format Interoperability: Schemas can be authored in clean YAML syntax or traditional JSON formatting. The validator automatically parses both formats into memory before schema compilation.
  • AJV Fast Validation Engine: Enforces strict JSON Schema standards (including Draft-07 keyword rules: type, properties, required, additionalProperties, minimum, maximum, and pattern).
  • Instance Path Pointer Diagnostics: Pinpoints structural failures with standard RFC 6901 JSON pointers (e.g. /servers/0/port or /database/connectionTimeout).

How to use the tool?

  1. Provide Schema Definition: Paste your JSON Schema (in YAML or JSON format) into the left YAML / JSON Schema Definition editor, click Upload Schema, or click Sample Schema.
  2. Provide Target YAML Data: Paste the YAML document you want to test against the contract into the right Target YAML Data Payload editor, click Upload Data, or click Sample Data.
  3. Live Verification: The validator checks your target data against the schema automatically in real time as you edit or upload.

Related Developer Utilities

If you work with schema validation, API contracts, and YAML configurations, explore these related tools:

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/yaml/schema) to programmatically validate YAML configuration payloads against JSON or YAML schemas.

API Request Parameters

Name Type Description Example
data / yaml String / Object Raw target YAML document string or parsed object to validate. "service: web-api\nreplicas: 3"
schema / rules String / Object The YAML or JSON Schema rules string or parsed object to validate against. "type: object\nproperties:\n service:\n type: string"

API Request Payload Examples

cURL (Using Raw String)

curl -X POST https://blueutils.com/api/yaml/schema \
  -H "Content-Type: application/json" \
  -d '{
    "data": "service: web-api\nreplicas: 3",
    "schema": "type: object\nproperties:\n  service:\n    type: string\n  replicas:\n    type: integer\nrequired:\n  - service\n  - replicas"
  }'

cURL (Using Direct Objects)

curl -X POST https://blueutils.com/api/yaml/schema \
  -H "Content-Type: application/json" \
  -d '{
    "yaml": {
      "service": "web-api",
      "replicas": 3
    },
    "rules": {
      "type": "object",
      "properties": {
        "service": { "type": "string" },
        "replicas": { "type": "integer" }
      },
      "required": ["service", "replicas"]
    }
  }'

Python

import requests

url = "https://blueutils.com/api/yaml/schema"
payload = {
    "data": "service: web-api\nreplicas: 3",
    "schema": "type: object\nproperties:\n  service:\n    type: string\n  replicas:\n    type: integer\nrequired:\n  - service\n  - replicas"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = """
            {
                "data": "service: web-api\\nreplicas: 3",
                "schema": "type: object\\nproperties:\\n  service:\\n    type: string\\n  replicas:\\n    type: integer\\nrequired:\\n  - service\\n  - replicas"
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/yaml/schema"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Returns true if the YAML payload satisfies the target schema. true
message String Confirmation message returned when validation succeeds. "YAML data matches the provided schema successfully."
data Object / Array Parsed native representation of the validated YAML document. {"service":"web-api"}
schema Object Parsed native representation of the target schema. {"type":"object"}
originalSize Number Byte size of the raw target data input in UTF-8. 30
resultSize Number Byte size of the target schema definition in UTF-8. 98
errors Array Array of specific error objects (path, message, params) when validation fails. [...]
error String Summary error message returned when validation fails. "YAML schema validation failed."

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "message": "YAML data matches the provided schema successfully.",
  "data": {
    "service": "web-api",
    "replicas": 3
  },
  "schema": {
    "type": "object",
    "properties": {
      "service": { "type": "string" },
      "replicas": { "type": "integer" }
    },
    "required": ["service", "replicas"]
  },
  "originalSize": 30,
  "resultSize": 98
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "YAML schema validation failed.",
  "errors": [
    {
      "path": "/replicas",
      "message": "must be integer",
      "params": { "type": "integer" }
    }
  ]
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Why use an API to validate YAML against a schema?

Integrating the YAML Schema Validator API into deployment pipelines, Git hooks, or testing tools provides several key advantages:

  • Rapid Script Validation: Enables automated CI/CD checks to verify microservice configuration files, OpenAPI specs, and deployment manifests against strict schemas before rollout.
  • Optimized Token Efficiency for AI Agents: Offloading schema checking to an API prevents AI agents from spending LLM generation tokens on tedious constraint matching.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% deterministic schema enforcement using AJV without missed required keys or hallucinated type assertions.

Native Usage

How to validate YAML files against JSON schemas locally using terminal tools and scripts:

Visual Studio Code & JetBrains Shortcuts

  • VS Code: Use $schema modeline or yaml.schemas setting in .vscode/settings.json.
  • JetBrains IDEs: Configure JSON Schema mappings under Settings > Languages & Frameworks > Schemas and DTDs > JSON Schema Mappings.

Windows (CMD / PowerShell)

# Validate YAML against schema using check-jsonschema CLI
check-jsonschema --schemafile schema.json config.yaml

Linux / Unix (Bash)

# Validate YAML configuration against schema in terminal
check-jsonschema --schemafile schema.json config.yaml

Python

Using jsonschema and PyYAML in Python:

import yaml
import jsonschema

with open("schema.yaml", "r", encoding="utf-8") as sf, open("data.yaml", "r", encoding="utf-8") as df:
    schema = yaml.safe_load(sf)
    data = yaml.safe_load(df)

try:
    jsonschema.validate(instance=data, schema=schema)
    print("YAML data satisfies schema!")
except jsonschema.exceptions.ValidationError as e:
    print(f"Validation error at {e.json_path}: {e.message}")

Java

Using NetworkNT json-schema-validator and Jackson in Java 17+:

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import com.networknt.schema.JsonSchema;
import com.networknt.schema.JsonSchemaFactory;
import com.networknt.schema.SpecVersion;
import com.networknt.schema.ValidationMessage;

import java.io.File;
import java.util.Set;

public class YamlSchemaValidatorExample {
    public static void main(String[] args) throws Exception {
        YAMLMapper mapper = new YAMLMapper();
        JsonNode dataNode = mapper.readTree(new File("data.yaml"));
        JsonNode schemaNode = mapper.readTree(new File("schema.yaml"));

        JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7);
        JsonSchema schema = factory.getSchema(schemaNode);

        Set<ValidationMessage> errors = schema.validate(dataNode);
        if (errors.isEmpty()) {
            System.out.println("YAML payload satisfies the schema.");
        } else {
            errors.forEach(err -> System.err.println(err.getMessage()));
        }
    }
}

Frequently Asked Questions (FAQ)

Can I define my JSON Schema contract directly in YAML format?

Yes. The validator natively parses schemas written in clean YAML syntax as well as standard JSON schemas, compiling them with AJV for compliance checking.

Which JSON Schema drafts and validation keywords are supported?

Powered by AJV, the validator supports standard Draft-07 keywords including type, properties, required, additionalProperties, enum, pattern, minimum, maximum, and items.

How does the validator pinpoint schema violation locations?

Validation failures report exact RFC 6901 JSON pointer paths (e.g. /servers/0/port or /replicas) along with the specific constraint keyword that failed.

Can I validate multi-document YAML files against a schema?

To validate multi-document streams separated by ---, split the documents and validate individual records, or define an array schema wrapping multiple document items.

Are my schema files or configuration payloads uploaded to any remote server?

No. Schema validation executes 100% client-side directly within your browser session using in-memory parsing, ensuring that cloud manifests and secrets remain strictly private.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.