Skip to main content

Array properties

Arrays are lists.

Use arrays when the answer can have many items.

Examples:

  • Several diagnoses.
  • Several allergies.
  • Several medications.
  • Several exercises.

Core fields

FieldMeaning
itemsThe shape of each item in the list. Required.
minItemsMinimum number of items.
maxItemsMaximum number of items.
uniqueItemsWhether duplicates are allowed.

List of coded strings

Use this for diagnoses or medications.

"diagnoses": {
"title": "Diagnoses",
"type": "array",
"description": "ICD codes relevant to this visit",
"minItems": 1,
"items": {
"type": "string",
"oneOf": [
{ "const": "M75.1", "title": "Rotator cuff tear" },
{ "const": "M75.2", "title": "Bicipital tendinitis" },
{ "const": "M25.5", "title": "Pain in joint" }
]
}
}

List of objects

Use this when each item has several fields.

"exercises": {
"title": "Recommended exercises",
"type": "array",
"description": "List each exercise the patient should perform",
"items": {
"title": "Exercise",
"type": "object",
"properties": {
"name": { "title": "Name", "type": "string" },
"frequency": { "title": "Times per week", "type": "integer", "minimum": 1 }
},
"required": ["name"]
},
"minItems": 1,
"maxItems": 10
}

This lets the doctor add multiple exercises, and each exercise has its own name and frequency.