{"id":"json-schema-type-mismatches","version":"1.0.0","description":"List every value whose JSON type fails a JSON Schema 2020-12 \"type\" keyword, with expected and actual types.","supported_operations":["find wrong types in llm json output","which values have the wrong json type for the schema","list type mismatches with expected and actual type","json pointer of every value failing the type keyword","detect numbers returned as strings in structured output","is 1.0 an integer under json schema 2020-12"],"unsupported_operations":["coercing values to the expected type (for example \"42\" to 42)","other assertions such as enum, const, minimum, minLength, pattern or format","schemas using allOf/anyOf/oneOf/not/if/patternProperties/prefixItems, remote or anchor $ref (unsupported_input)"],"semantics":["Validation 6.1.1: type is one name or an array of unique names from null, boolean, object, array, number, string, integer; a value passes when its type matches any listed name. An empty type array matches nothing.","integer matches any number with a zero fractional part, so 1.0 is an integer; number matches every number. The test applies to the IEEE-754 double the value arrives as (JSON text such as 1.0000000000000001 has already become 1). actual reports \"integer\" for an integer-valued number and \"number\" otherwise.","expected lists the keyword's names in schema order (a single string becomes a one-element array). A mismatching value is still traversed: properties, additionalProperties and items keep applying to its children.","Applicability follows Core 2020-12: properties, additionalProperties as a subschema, items as a single subschema, same-document fragment $ref with sibling keywords, $defs and boolean subschemas. Other keywords are ignored (Core 6.5) except the unsupported applicators, which throw unsupported_input.","instance_pointer is an RFC 6901 JSON string representation; keyword_location is the evaluation path to the type keyword including \"$ref\" steps (Core 12.3.1); schema_pointer is that keyword's location in the schema document. Order: pre-order over instance locations (members by ascending UTF-16 code units, elements by index), then schemas in application order.","count is the total number of failures; at most max_results are listed and truncated is true when count exceeds it; valid is true exactly when count is 0. Lone surrogates in any string or property name, non-finite numbers and non-JSON values throw invalid_input; a $ref cycle with no instance progress throws not_computable."],"limits":{"max_input_bytes":262144,"max_depth":64,"max_nodes":20000,"max_schema_evaluations":100000,"max_results":256,"max_output_bytes":1048576},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["schema","instance"],"properties":{"schema":{"type":["object","boolean"],"additionalProperties":{"description":"Any JSON value (keyword value)."},"description":"A JSON Schema 2020-12 schema (object or boolean)."},"instance":{"description":"The JSON value to diagnose (any JSON value)."}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","count","truncated","mismatches"],"properties":{"valid":{"type":"boolean"},"count":{"type":"integer","minimum":0},"truncated":{"type":"boolean"},"mismatches":{"type":"array","maxItems":256,"items":{"type":"object","additionalProperties":false,"required":["instance_pointer","expected","actual","keyword_location","schema_pointer"],"properties":{"instance_pointer":{"type":"string","pattern":"^(?:/[\\s\\S]*)?$"},"expected":{"type":"array","maxItems":7,"uniqueItems":true,"items":{"type":"string","enum":["array","boolean","integer","null","number","object","string"]}},"actual":{"type":"string","enum":["array","boolean","integer","null","number","object","string"]},"keyword_location":{"type":"string","pattern":"^(?:/[\\s\\S]*)?$"},"schema_pointer":{"type":"string","pattern":"^(?:/[\\s\\S]*)?$"}}}}}},"examples":[{"input":{"schema":{"type":"object","properties":{"age":{"type":"integer"},"tags":{"type":"array","items":{"type":"string"}}}},"instance":{"age":"42","tags":["a",3]}},"output":{"valid":false,"count":2,"truncated":false,"mismatches":[{"instance_pointer":"/age","expected":["integer"],"actual":"string","keyword_location":"/properties/age/type","schema_pointer":"/properties/age/type"},{"instance_pointer":"/tags/1","expected":["string"],"actual":"integer","keyword_location":"/properties/tags/items/type","schema_pointer":"/properties/tags/items/type"}]}},{"input":{"schema":{"type":["integer","null"]},"instance":2.5},"output":{"valid":false,"count":1,"truncated":false,"mismatches":[{"instance_pointer":"","expected":["integer","null"],"actual":"number","keyword_location":"/type","schema_pointer":"/type"}]}}],"execute_url":"/v1/tools/json-schema-type-mismatches/versions/1.0.0/execute"}