String properties
Strings are text.
Use strings for:
- Short text.
- Long notes.
- Dates.
- Codes.
- Single coded choices.
Common constraints
| Constraint | Meaning |
|---|---|
minLength | Text must be long enough. |
maxLength | Text must not be too long. |
pattern | Text must match a strict pattern. |
format | Text has a known format, like date or email. |
enum | Pick one plain value. |
oneOf | Pick 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.