{"id":"schema-witness","title":"One valid and one invalid example for each constraint in a JSON Schema","description":"Walks a caller-supplied JSON Schema 2020-12 and, for every constraint keyword (type, enum, const, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, minLength, maxLength, pattern, format, minItems, maxItems, uniqueItems, required, minProperties, maxProperties, additionalProperties false, dependentRequired), returns the JSON pointer of the constraint, an example that satisfies it and a boundary example that violates it. Every pair is verified by running both examples through the interpreter against a schema holding only that constraint, so each valid example passes and each invalid example fails exactly that rule. For agents that need test inputs or few-shot examples for a tool schema. Constraints inside combinators are included; $ref targets are visited under $defs. Constraints it cannot build a verified pair for (exotic patterns, huge limits) are listed as unresolved, never guessed.","roi":"Boundary examples (limit-1, limit, limit+1) for up to 100 constraints per $0.005 call, each machine-verified.","audience":"developer","package":"data-contract-kit","channels":["x402","mcp"],"endpoint":{"method":"POST","url":"https://agents.writerslogic.com/api/v1/schema-witness","path":"/api/v1/schema-witness","contentType":"application/json"},"price":{"amount":"0.005","currency":"USDC","network":"base","perCall":true,"failedCallsCharged":false},"inputSchema":{"type":"object","additionalProperties":false,"required":["schema"],"properties":{"schema":{"description":"The schema to generate examples for. Full JSON Schema 2020-12 (local $ref only)."},"maxConstraints":{"type":"integer","minimum":1,"maximum":100,"description":"Stop after this many constraints (default 100)."}}},"resultSchema":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"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."},"pairs":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"JSON pointer of the constraint keyword inside the schema."},"keyword":{"type":"string"},"constraint":{"description":"The keyword's value."},"valid":{"description":"An instance that satisfies the constraint (at the boundary where one exists)."},"invalid":{"description":"An instance that violates only this constraint."}}}},"unresolved":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"keyword":{"type":"string"},"reason":{"type":"string"}}}},"constraintCount":{"type":"integer"},"truncated":{"type":"boolean"},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"outputSchema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"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."},"pairs":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"JSON pointer of the constraint keyword inside the schema."},"keyword":{"type":"string"},"constraint":{"description":"The keyword's value."},"valid":{"description":"An instance that satisfies the constraint (at the boundary where one exists)."},"invalid":{"description":"An instance that violates only this constraint."}}}},"unresolved":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"keyword":{"type":"string"},"reason":{"type":"string"}}}},"constraintCount":{"type":"integer"},"truncated":{"type":"boolean"},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]},"example":{"schema":{"type":"object","required":["name","age"],"properties":{"name":{"type":"string","minLength":2,"maxLength":5},"age":{"type":"integer","minimum":0,"maximum":150}},"additionalProperties":false}},"openapiOperation":{"operationId":"schema_witness","summary":"One valid and one invalid example for each constraint in a JSON Schema","description":"Walks a caller-supplied JSON Schema 2020-12 and, for every constraint keyword (type, enum, const, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, minLength, maxLength, pattern, format, minItems, maxItems, uniqueItems, required, minProperties, maxProperties, additionalProperties false, dependentRequired), returns the JSON pointer of the constraint, an example that satisfies it and a boundary example that violates it. Every pair is verified by running both examples through the interpreter against a schema holding only that constraint, so each valid example passes and each invalid example fails exactly that rule. For agents that need test inputs or few-shot examples for a tool schema. Constraints inside combinators are included; $ref targets are visited under $defs. Constraints it cannot build a verified pair for (exotic patterns, huge limits) are listed as unresolved, never guessed.\n\nPrice: 0.005 USDC on Base (x402).","x-x402-price-usdc":"0.005","x-x402-amount":"5000","x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"0.005"}},"x-audience":"developer","x-sample-url":"https://agents.writerslogic.com/api/v1/samples/schema-witness","security":[{"x402":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["schema"],"properties":{"schema":{"description":"The schema to generate examples for. Full JSON Schema 2020-12 (local $ref only)."},"maxConstraints":{"type":"integer","minimum":1,"maximum":100,"description":"Stop after this many constraints (default 100)."}}},"example":{"schema":{"type":"object","required":["name","age"],"properties":{"name":{"type":"string","minLength":2,"maxLength":5},"age":{"type":"integer","minimum":0,"maximum":150}},"additionalProperties":false}}}}},"responses":{"200":{"description":"Paid result with provenance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"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."},"pairs":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"JSON pointer of the constraint keyword inside the schema."},"keyword":{"type":"string"},"constraint":{"description":"The keyword's value."},"valid":{"description":"An instance that satisfies the constraint (at the boundary where one exists)."},"invalid":{"description":"An instance that violates only this constraint."}}}},"unresolved":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"keyword":{"type":"string"},"reason":{"type":"string"}}}},"constraintCount":{"type":"integer"},"truncated":{"type":"boolean"},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]}}}},"400":{"description":"Invalid request (no payment consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"401":{"description":"Invalid X-API-KEY","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"402":{"description":"Payment required or invalid","content":{"application/json":{"schema":{"type":"object","description":"x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"resource":{"type":"object"},"accepts":{"type":"array","items":{"type":"object"}},"extensions":{"type":"object"}}}}}},"502":{"description":"Upstream failure; the payment is released or not settled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}}},"links":{"docs":"https://agents.writerslogic.com/docs/schema-witness/","docsJson":"https://agents.writerslogic.com/docs/schema-witness.json","sample":"https://agents.writerslogic.com/api/v1/samples/schema-witness","openapi":"https://agents.writerslogic.com/openapi.json","catalog":"https://agents.writerslogic.com/api/v1/catalog","verifyProvenance":"https://agents.writerslogic.com/api/v1/verify-provenance","index":"https://agents.writerslogic.com/docs/index.json"}}