{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://earslang.com/schema/0.1/diff.schema.json",
  "$comment": "CC BY 4.0, Copyright 2026 Richard Pringle II: https://creativecommons.org/licenses/by/4.0/",
  "title": "earslang diff report, output format 0.1",
  "description": "What `ears diff --json` writes to standard output (spec §11.5): every kind of change in Table 11.5, in its order, each with the rules listed under it. A rule can be listed under more than one kind (S16.1).",
  "type": "object",
  "required": ["version", "against", "kinds"],
  "additionalProperties": false,
  "properties": {
    "version": {
      "description": "The version of this output format, the same as that of the compiled rules (spec.schema.json).",
      "const": "0.1"
    },
    "against": {
      "description": "The git revision the rules were compared with, as given to --against.",
      "type": "string",
      "minLength": 1
    },
    "kinds": {
      "description": "The changes of each kind. A kind with no changes has an empty list.",
      "type": "object",
      "required": ["added", "removed", "dropped", "downgraded", "accepted", "reworded", "weakened", "strengthened", "reversed"],
      "additionalProperties": false,
      "properties": {
        "added": { "$ref": "#/$defs/entries" },
        "removed": { "$ref": "#/$defs/entries" },
        "dropped": { "$ref": "#/$defs/entries" },
        "downgraded": { "$ref": "#/$defs/entries" },
        "accepted": { "$ref": "#/$defs/entries" },
        "reworded": { "$ref": "#/$defs/entries" },
        "weakened": { "$ref": "#/$defs/entries" },
        "strengthened": { "$ref": "#/$defs/entries" },
        "reversed": { "$ref": "#/$defs/entries" }
      }
    }
  },
  "$defs": {
    "entries": {
      "description": "The rules listed under one kind.",
      "type": "array",
      "items": { "$ref": "#/$defs/entry" }
    },
    "entry": {
      "description": "One changed rule.",
      "type": "object",
      "required": ["id", "file", "lines", "before", "after"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "The rule's ID, or null when it has none (S16.2, S16.3).",
          "oneOf": [
            { "type": "null" },
            { "$ref": "spec.schema.json#/$defs/id" }
          ]
        },
        "file": {
          "description": "The path of the rule's file now, or where it was for a removed rule, as in the compiled rules.",
          "type": "string",
          "minLength": 1
        },
        "lines": {
          "description": "The rule's first and last line now, or where it was for a removed rule.",
          "$ref": "spec.schema.json#/$defs/lines"
        },
        "before": {
          "description": "The rule as it was: its ID, its text and its tags on one line, or null for an added rule.",
          "type": ["string", "null"]
        },
        "after": {
          "description": "The rule as it is now, written the same way, or null for a removed rule.",
          "type": ["string", "null"]
        }
      }
    }
  }
}
