parseInt accepts a number at the start of broken input
JavaScript can turn a damaged quantity into a plausible integer. Validate the complete text, then check the numeric range before accepting a count from a form or configuration file.
Topic · 8 stories
8 stories tagged validation on AI Tamer, newest first.
JavaScript can turn a damaged quantity into a plausible integer. Validate the complete text, then check the numeric range before accepting a count from a form or configuration file.
Before you reuse a JSON Schema with strict structured outputs, audit it against the supported keywords and move the rules that do not fit into your own validation code.
Collecting an iterator of Result values into Result<Vec<T>, E> stops on the first Err. Choose that behavior for fail-fast loading, or collect errors explicitly for a full report.
A repeated JSON object name can produce different results in different parsers. Here is how to spot the problem and reject it.
A response can satisfy two JSON Schema branches and still fail validation. This example shows how overlapping object shapes cause that result and how to make the branches distinct.
A list of expected fields does not close a JSON object. Here is how to decide when model-generated objects should reject unknown keys.
Three ways to get machine-readable output from a model. What JSON mode, strict tool calls and grammar-constrained decoding each guarantee, what they leave open, and how to validate.
A practical guide to JSON mode, schema-constrained output, and tool calling, with the limits that still require validation in your application.