{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://yarramate.org/schema/visual-diagnostic-result/v1",
  "title": "YarraMate visual diagnostic result",
  "type": "object",
  "additionalProperties": false,
  "required": ["format", "diagnostics"],
  "properties": {
    "format": {
      "const": "yarramate/visual-diagnostic-result/v1"
    },
    "diagnostics": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "items": {
        "$ref": "#/$defs/diagnostic"
      }
    }
  },
  "$defs": {
    "diagnostic": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "severity",
        "code",
        "message",
        "path",
        "pointer",
        "line",
        "column"
      ],
      "properties": {
        "severity": {
          "const": "error"
        },
        "code": {
          "type": "string",
          "pattern": "^YMVS[0-9]{3}$"
        },
        "message": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4000
        },
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "pointer": {
          "type": "string",
          "pattern": "^/"
        },
        "line": {
          "type": "integer",
          "minimum": 1
        },
        "column": {
          "type": "integer",
          "minimum": 1
        },
        "subjects": {
         "type": "array",
         "maxItems": 64,
         "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
         }
        }
      }
    }
  }
}
