JSON schema batch validate
json-schema-batch-validate · version 1.0.0 · JSON & JSONL · free, no key needed
Validate many JSON records against one Draft 2020-12 subset schema; per-record validity, error pointers, counts.
Use when you need to: validate a batch of generated json records against one schema · check every llm generated object in a list against json schema 2020-12 · per record json schema errors with json pointer paths.
Decide before calling
Read the versioned contract and the supported scope below. Reuse json-schema-batch-validate@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use json-schema-batch-validate@1.0.0 for validate a batch of generated json records against one schema. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- validate a batch of generated json records against one schema
- check every llm generated object in a list against json schema 2020-12
- per record json schema errors with json pointer paths
- how many records in this dataset fail the schema
- bulk validate synthetic records with one draft 2020-12 schema
- בדיקת רשומות רבות מול JSON Schema 2020-12
Not supported
- pattern, patternProperties, propertyNames, contains, if/then/else, dependent*, unevaluated* keywords (unsupported_input)
- remote, relative or anchor $ref and embedded $id resources
- one schema per record or schema inference from records
- repairing, coercing or deduplicating records
- JSON Lines text input (pass parsed records)
Behavior
- One schema (object or boolean) is compiled once and applied to each element of items in order; index is the 0-based position. Supported keywords, annotations and refusals are identical to the family validator: $schema (2020-12 URI, root only), $id (root only), $defs, $ref ("#"-fragment, same document), allOf, anyOf, oneOf, not, type, enum, const, multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, required, properties, additionalProperties, maxProperties, minProperties, prefixItems, items, maxItems, minItems, uniqueItems; title, description, default, examples, deprecated, readOnly, writeOnly, format, $comment, contentEncoding, contentMediaType are ignored; any other keyword is unsupported_input.
- output_format is "basic" when omitted: {item_count, valid_count, invalid_count, error_count, truncated, results:[{index, valid, errors, truncated}]}. Each error is a leaf output unit {keyword_location, absolute_keyword_location?, instance_location, keyword, params}; instance_location is relative to the record. "flag" returns only {results:[{index, valid}]} and stops each record at its first failure (core 12.4.1).
- Per record, keywords are evaluated in a fixed order: $ref, allOf, anyOf, oneOf, not, type, enum, const, multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, required (listed order), then instance members ascending by UTF-16 code units (each checked by properties when listed there, otherwise by additionalProperties), maxProperties, minProperties, then elements by index (prefixItems, then items), maxItems, minItems, uniqueItems. Errors are listed in that order; schema and record key order never change results.
- anyOf, oneOf and not give one unit (branch_count, passing_count). A false subschema is reported under its applicator (properties/additionalProperties: property; items/prefixItems/allOf: index; $ref) or as false_schema at the root. absolute_keyword_location appears only when the root $id is an absolute URI and the path crossed a $ref.
- type integer = zero fractional part; lengths in code points; enum/const/uniqueItems use JSON equality; multipleOf is exact on shortest round-trip decimals.
- At most 500 error units are reported across the whole batch; after that each record is still classified exactly (valid flags and counts stay exact) and truncated marks records with unreported failures.
- Bounds: input 131072 bytes; 1000 items; the schema and each record nested at most 32 levels (max_value_depth; a scalar is 0, [] or {} is 1); 64 nested subschema applications; 50000 work units for the whole batch (1 per subschema application, 1 per member or element scanned by properties/additionalProperties, prefixItems/items or uniqueItems, 1 per required name); output 262144 bytes. Exceeding any is limit_exceeded.
Input
schema(any JSON value, required): JSON Schema 2020-12 document (object or boolean) within the supported subsetitems(array of any JSON value, required): max items 1000output_format(one of "basic", "flag", optional)
Output
item_count(integer, optional): min 0valid_count(integer, optional): min 0invalid_count(integer, optional): min 0error_count(integer, optional): min 0; max 500truncated(boolean, optional)results(array of object, required): max items 1000
Limits
- max input bytes: 131072
- max items: 1000
- max value depth: 32
- max evaluation depth: 64
- max evaluation work: 50000
- max errors: 500
- max output bytes: 262144
Example
Request input:
{
"schema": {
"type": "object",
"required": [
"sku",
"qty"
],
"properties": {
"sku": {
"type": "string"
},
"qty": {
"type": "integer",
"minimum": 1
}
}
},
"items": [
{
"sku": "A1",
"qty": 2
},
{
"sku": "B2",
"qty": 0
},
{
"qty": 1.5
}
]
}
Response:
{
"result": {
"item_count": 3,
"valid_count": 1,
"invalid_count": 2,
"error_count": 3,
"truncated": false,
"results": [
{
"index": 0,
"valid": true,
"errors": [],
"truncated": false
},
{
"index": 1,
"valid": false,
"errors": [
{
"keyword_location": "/properties/qty/minimum",
"instance_location": "/qty",
"keyword": "minimum",
"params": {
"limit": 1
}
}
],
"truncated": false
},
{
"index": 2,
"valid": false,
"errors": [
{
"keyword_location": "/required",
"instance_location": "",
"keyword": "required",
"params": {
"property": "sku"
}
},
{
"keyword_location": "/properties/qty/type",
"instance_location": "/qty",
"keyword": "type",
"params": {
"expected": [
"integer"
],
"actual": "number"
}
}
],
"truncated": false
}
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "json-schema-batch-validate",
"version": "1.0.0",
"input": {
"schema": {
"type": "object",
"required": [
"sku",
"qty"
],
"properties": {
"sku": {
"type": "string"
},
"qty": {
"type": "integer",
"minimum": 1
}
}
},
"items": [
{
"sku": "A1",
"qty": 2
},
{
"sku": "B2",
"qty": 0
},
{
"qty": 1.5
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/json-schema-batch-validate/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"schema":{"type":"object","required":["sku","qty"],"properties":{"sku":{"type":"string"},"qty":{"type":"integer","minimum":1}}},"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":0},{"qty":1.5}]}'
The machine-readable contract is at /v1/tools/json-schema-batch-validate/versions/1.0.0.
CLI
node cli.mjs run json-schema-batch-validate 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- JSON schema valid items filter: Keep only the JSON records that pass (or fail) one Draft 2020-12 subset schema; returns kept records and index lists.
- JSON schema errors group: Group batch JSON Schema errors by failing schema rule or data path; exact counts and record indexes, stable order.
- JSON schema validate: Validate a JSON instance against ComputeFirst Schema 1.0.
- JSON pointer list: List RFC 6901 pointers to every reachable JSON node, root first.
- JSONL validate: Validate strict JSON Lines text and report the value count and UTF-8 byte length.
- JSON array rename keys: Rename specific keys in each object in a JSON array.