JSON schema errors group
json-schema-errors-group · version 1.0.0 · JSON & JSONL · free, no key needed
Group batch JSON Schema errors by failing schema rule or data path; exact counts and record indexes, stable order.
Use when you need to: which schema rule fails most across my generated records · summarize batch json schema errors by keyword location · group validation errors by json pointer data path across records.
Decide before calling
Read the versioned contract and the supported scope below. Reuse json-schema-errors-group@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-errors-group@1.0.0 for which schema rule fails most across my generated records. 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
- which schema rule fails most across my generated records
- summarize batch json schema errors by keyword location
- group validation errors by json pointer data path across records
- count records failing each json schema constraint
- top failing fields in a batch of llm json outputs
- סיכום שגיאות סכמה לפי שדה בכל הרשומות
Not supported
- validating records (use json-schema-batch-validate first)
- fuzzy or similarity clustering of error messages
- grouping by wildcard path patterns such as /items/*/price
- statistics beyond exact counts (rates, percentiles)
Behavior
- Input results are json-schema-batch-validate basic results: [{index, valid, errors, truncated}] with unique non-negative indexes; each error is a leaf unit {keyword_location, absolute_keyword_location?, instance_location, keyword, params} with exactly the params keys of its keyword and RFC 6901 locations. A valid result must have no errors and truncated false; an invalid one needs at least one error or truncated true. Anything else is invalid_input.
- group_by is "keyword_location" when omitted (one group per failing schema rule, keyed by the dynamic keyword location); "instance_location" makes one group per failing data path inside a record. Keys are compared as exact strings.
- Each group is {key, keywords, error_count, item_count, item_indexes}: keywords are the distinct unit keywords in UTF-16 code-unit order, error_count the number of units, item_indexes the distinct record indexes ascending, item_count their number.
- Groups are ordered by error_count descending, then item_count descending, then key by RFC 6901 tokens (array-index tokens first in numeric order, other tokens by UTF-16 code units, a proper prefix first). Input order of results and units never changes the output.
- Top level: {group_by, result_count, invalid_count, error_count, incomplete, groups}; incomplete is true when any result had truncated true (some failures were not reported, so counts cover reported units only).
- Bounds: input 262144 bytes, 1000 results, 500 units in total; exceeding any is limit_exceeded. Input nested deeper than any valid results document (6 levels) is invalid_input. No output cap: groups never outnumber units and every index or keyword in the output comes from one input unit, so output stays below the input size plus 128 bytes plus 96 bytes per group.
Input
results(array of object, required): max items 1000group_by(one of "keyword_location", "instance_location", optional)
Output
group_by(one of "keyword_location", "instance_location", required)result_count(integer, required): min 0; max 1000invalid_count(integer, required): min 0; max 1000error_count(integer, required): min 0; max 500incomplete(boolean, required)groups(array of object, required): max items 500
Limits
- max input bytes: 262144
- max results: 1000
- max errors: 500
Example
Request input:
{
"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/minimum",
"instance_location": "/qty",
"keyword": "minimum",
"params": {
"limit": 1
}
}
],
"truncated": false
}
]
}
Response:
{
"result": {
"group_by": "keyword_location",
"result_count": 3,
"invalid_count": 2,
"error_count": 3,
"incomplete": false,
"groups": [
{
"key": "/properties/qty/minimum",
"keywords": [
"minimum"
],
"error_count": 2,
"item_count": 2,
"item_indexes": [
1,
2
]
},
{
"key": "/required",
"keywords": [
"required"
],
"error_count": 1,
"item_count": 1,
"item_indexes": [
2
]
}
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "json-schema-errors-group",
"version": "1.0.0",
"input": {
"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/minimum",
"instance_location": "/qty",
"keyword": "minimum",
"params": {
"limit": 1
}
}
],
"truncated": false
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/json-schema-errors-group/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"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/minimum","instance_location":"/qty","keyword":"minimum","params":{"limit":1}}],"truncated":false}]}'
The machine-readable contract is at /v1/tools/json-schema-errors-group/versions/1.0.0.
CLI
node cli.mjs run json-schema-errors-group 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- JSON schema batch validate: Validate many JSON records against one Draft 2020-12 subset schema; per-record validity, error pointers, counts.
- 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 array group count: Group an array of JSON objects by exact keys and return the count.
- JSON array group by: Group an array of JSON objects by exact keys.
- JSON array rename keys: Rename specific keys in each object in a JSON array.
- JSON array anti join: Anti join two JSON arrays of objects on exact keys.