Beyond type: how to say 'string but only a UUID'
String constraints
minLength,maxLength— character-count bounds.pattern— ECMAScript-style regex. The string must match.format— predefined named formats (email, uri, date, date-time, uuid, ipv4, ipv6, hostname, regex).
Number constraints
minimum,maximum— inclusive bounds.exclusiveMinimum,exclusiveMaximum— exclusive bounds.multipleOf— must be a multiple of this value (use 1 to enforce integer-like in a number field).
'format' is advisory by default
Crucial gotcha: in Draft 2020-12, format keywords are annotations, not constraints, by default. "format": "email" doesn't reject invalid emails unless you configure your validator to enforce formats. ajv: { formats: addFormats } from ajv-formats. Python jsonschema: pass format_checker=Draft202012Validator.FORMAT_CHECKER.
The format trap: teams ship a schema with
"format": "email", run it with default ajv, and assume malformed emails get rejected. They don't. Test the negative case — pass an obviously broken value and confirm the validator complains. If it doesn't, your formats are off.