Pattern

Validate the output's meaning after its shape passes

A perfectly shaped address can still point to the wrong place.

About 1 min read

Before you use it

Use when
  • An AI response is valid JSON and therefore being treated as safe to execute.

Keep this limit in mind

  • Some schemas encode substantial business constraints. State exactly which checks ran rather than assuming either that schemas check everything or that they check nothing useful.

An idea to explore.

Try this idea.

Inspect the example, try the idea in your situation, then check your next move.

Keep reading

What to look for

A perfectly shaped address can still point to the wrong place.

Why it matters

Use structural validation to reject missing fields, invalid types and unexpected properties. Then apply separate checks for identity, permissions, ranges and evidence. A schema verifies the constraints it encodes; it does not automatically verify external facts or the user's intent.

An example

A recipient field contains a valid string, but the named recipient is outside the approved audience. Parsing success must not authorize sending.

Check your result

Tests include well-formed but semantically wrong outputs, not only malformed JSON.

Save and practise this idea

My learning

Read. Recall. Repeat.

Save this idea and return to it on any device.

Use email
Keep exploring

Connected ideas

You are readingValidate the output's meaning after its shape passes

Evidence and sources
Supports

JSON Schema can constrain required properties, value types and additional fields in an output object.

An external fact or business rule is not validated merely because the object satisfies structural constraints that do not encode it.

Understanding JSON Schema: object · Properties; Required Properties; Additional Properties

All sources (1)
Edition and review

Version 0.1.0

No review details are supplied for this edition.

Read this idea as JSON · Release details