{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://verio.dev/schema/architecture.schema.json",
  "title": "Architecture file",
  "description": "The software architecture (IEC 62304 5.3) kept in a file of its own beside the design \u2014 `architecture.yaml`, whose root is the `architecture:` the design would otherwise hold. Named sections of prose, nesting as deep as the architecture goes. A design keeps it in one place or the other, never both.",
  "type": "object",
  "required": [
    "architecture"
  ],
  "additionalProperties": false,
  "properties": {
    "architecture": {
      "$ref": "#/$defs/sections"
    }
  },
  "$defs": {
    "name": {
      "type": "string",
      "description": "A section's heading, which is also its key. Unique among its siblings.",
      "minLength": 1,
      "maxLength": 200
    },
    "sections": {
      "type": "object",
      "description": "Sections keyed by identifier.",
      "propertyNames": {
        "$ref": "#/$defs/name"
      },
      "additionalProperties": {
        "$ref": "#/$defs/section"
      }
    },
    "section": {
      "type": "object",
      "description": "One section of prose. Its heading is its key.",
      "properties": {
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Body, as markdown."
        },
        "subsections": {
          "description": "The sections below this one, in document order. A bare `subsections:` parses as null and is read as none.",
          "anyOf": [
            {
              "$ref": "#/$defs/sections"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": true
    }
  }
}
