Skip to main content

String properties

Strings are text.

Use strings for:

  • Short text.
  • Long notes.
  • Dates.
  • Codes.
  • Single coded choices.

Common constraints

ConstraintMeaning
minLengthText must be long enough.
maxLengthText must not be too long.
patternText must match a strict pattern.
formatText has a known format, like date or email.
enumPick one plain value.
oneOfPick one coded value with a label.

Free text

"pain-description": {
"title": "Describe the pain",
"type": "string",
"description": "How does it feel, when did it start, and what makes it better or worse?",
"minLength": 10,
"maxLength": 500,
"examples": ["Sharp pain when lifting the arm above the shoulder"]
}

Coded single choice

"pain-area": {
"title": "Pain area",
"type": "string",
"description": "Pick the main area affected",
"oneOf": [
{ "const": "LEFT_SHOULDER", "title": "Left shoulder" },
{ "const": "RIGHT_SHOULDER", "title": "Right shoulder" },
{ "const": "BILATERAL", "title": "Both shoulders" }
]
}

The doctor sees Left shoulder. The stored value is LEFT_SHOULDER.

Date

"surgery-date": {
"title": "Surgery date",
"type": "string",
"format": "date",
"description": "Date when the surgery happened"
}

Simple rule

If the AI needs to write words, use string. If the AI must choose one option, use oneOf or a concept set.