Skip to main content
Use "type": "string" for free-form text fields. Then add constraints to control size, format, and allowed values.

Supported keywords

KeywordWhat it does
type: "string"Declares a text field
minLength / maxLengthBounds text length
patternEnforces a regex
formatSemantic format check (email, uri)

Length constraints

{
  "type": "object",
  "properties": {
    "username": {
      "type": "string",
      "minLength": 3,
      "maxLength": 120
    }
  },
  "required": ["username"],
  "additionalProperties": false
}
Use this to avoid empty outputs and cap long generations. The length bounds are inclusive.

Pattern constraints

{
  "type": "object",
  "properties": {
    "country_code": {
      "type": "string",
      "pattern": "^[A-Z]{2}$"
    }
  },
  "required": ["country_code"],
  "additionalProperties": false
}
This matches exactly two uppercase letters (for example country codes).

Format constraints

{
  "type": "object",
  "properties": {
    "email": { "type": "string", "format": "email" },
    "website": { "type": "string", "format": "uri" }
  },
  "required": ["email", "website"],
  "additionalProperties": false
}
Formats are named patterns that validate well-known string shapes. The following formats are currently supported:
FormatDescriptionExample of Accepted Value
date-timeRFC 3339 date-time"2026-03-23T14:30:00Z"
dateRFC 3339 date"2026-03-23"
date-time-localDate-time without timezone"2026-03-23T14:30:00"
timeRFC 3339 time with timezone"14:30:00Z"
time-localTime without timezone"14:30:00"
durationISO 8601 duration"P3Y6M4DT12H30M5S"
unixtimeSeconds since Unix epoch"1742739000"
utc-millisecMilliseconds since Unix epoch"1742739000000"
emailRFC 5321 email address"alice@example.com"
uuidRFC 9562 UUID"550e8400-e29b-41d4-a716-446655440000"
uriRFC 3986 URI"https://example.com/path"
uri-referenceURI or relative reference"/path/to/resource"
uri-templateRFC 6570 URI template"https://example.com/{id}"
urlFull URL with scheme"https://example.com"
hostnameRFC 1123 hostname"example.com"
ipv4IPv4 address"192.168.1.1"
ipv6IPv6 address"::1"
byteBase64-encoded string"SGVsbG8="
doubleDouble-precision float as string"3.141592653589793"
double-intInteger stored as double"42"
floatSingle-precision float as string"3.14"
int8Integer in [-128, 127]"42"
int16Integer in [-32768, 32767]"1000"
int32Integer in [-2³¹, 2³¹-1]"100000"
int64Integer in [-2⁶³, 2⁶³-1]"9999999999"
uint8Integer in [0, 255]"200"
uint16Integer in [0, 65535]"50000"
uint32Integer in [0, 2³²-1]"3000000000"
uint64Integer in [0, 2⁶⁴-1]"10000000000"
decimalArbitrary-precision decimal"99.95"
decimal128IEEE 754 decimal128"12345.6789012345"
sf-binaryRFC 8941 structured field binary":SGVsbG8=:"
sf-booleanRFC 8941 structured field boolean"?1"
sf-decimalRFC 8941 structured field decimal"3.14"
sf-integerRFC 8941 structured field integer"42"
sf-stringRFC 8941 structured field string"\"hello\""
sf-tokenRFC 8941 structured field token"abc"
exposeAny string (no validation)"anything"