Which oneOf / anyOf branch a JSON value matches, or why several or none do
Evaluates a JSON value against every branch of a oneOf or anyOf in a caller-supplied JSON Schema 2020-12 (or OpenAPI schema converted to it) and reports which branches match, the exact errors of each branch that fails with the JSON pointer of each offending value, the closest branch, and which branch an OpenAPI `discriminator` points to. For agents debugging why a tool or API payload is rejected with 'matches more than one' or 'matches none'. Local $ref only; patterns that risk catastrophic backtracking and unknown keywords are reported as unsupported, never as a match. It does not repair the value.
What you get
A oneOf failure message rarely says which branch you were closest to. Up to 25 branches per $0.005 call.
Call it
Send the JSON body below to https://agents.writerslogic.com/api/v1/union-branch. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.
curl -i -X POST https://agents.writerslogic.com/api/v1/union-branch \
-H 'content-type: application/json' \
-d '{"schema":{"oneOf":[{"type":"object","required":["card"],"properties":{"card":{"type":"string"}}},{"type":"object","required":["iban"],"properties":{"iban":{"type":"string"}}}]},"value":{"card":"4111","iban":"DE89"}}'
Input
| Field | Type | Required | Description |
|---|---|---|---|
schema | any | yes | The root schema; $ref targets are resolved inside it. Full JSON Schema 2020-12 (local $ref only). |
value | any | yes | The JSON value to classify. |
at | string; length 0..500 | no | JSON pointer to the subschema holding the union ("" for the root, "/properties/pet" for a nested one). |
keyword | string; one of "oneOf", "anyOf" | no | Required only when the subschema has both. |
Example request body
{
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"card"
],
"properties": {
"card": {
"type": "string"
}
}
},
{
"type": "object",
"required": [
"iban"
],
"properties": {
"iban": {
"type": "string"
}
}
}
]
},
"value": {
"card": "4111",
"iban": "DE89"
}
}
Result
The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.
| Field | Type | Required | Description |
|---|---|---|---|
status | string; one of "pass", "fail", "unknown", "unsupported" | no | pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass. |
keyword | string | no | |
at | string | no | |
branches | array<object> | no | |
matchedIndexes | array<integer> | no | |
closestBranch | one of | no | |
discriminator | one of | no | |
siblings | string; one of "match", "no-match", "unknown", "none" | no | Result of the keywords next to the union (everything except the union keyword). |
explanation | string | no | |
witnesses | array<object> | no | |
versions | object | no | Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile). |
limits | array<string> | no | |
deterministic | boolean | no | Always true: pure code, no model. |
Pay and connect
Available through: x402 (USDC on Base), MCP. MCP clients reach it through the data-contract-kit package.
Machine-readable
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent