{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://yarramate.org/schema/diagnostic-result/v1",
  "title": "YarraMate diagnostic result",
  "type": "object",
  "additionalProperties": false,
  "required": ["format", "diagnostics"],
  "properties": {
    "format": {
      "const": "yarramate/diagnostic-result/v1"
    },
    "diagnostics": {
      "type": "array",
      "minItems": 1,
      "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": "^YM[0-9]{3}$"
        },
        "message": {
          "type": "string",
          "minLength": 1
        },
        "path": {
          "type": "string",
          "minLength": 1
        },
        "pointer": {
          "type": "string",
          "pattern": "^/"
        },
        "line": {
          "type": "integer",
          "minimum": 1
        },
        "column": {
          "type": "integer",
          "minimum": 1
        },
        "subjects": {
          "description": "Subjects this diagnostic is about, most relevant first, when its pointer names one. Absent when the diagnostic belongs to no subject: a parse failure, a whole-document schema violation, a manifest, or a projection's own definition.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    }
  }
}
