{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cbsshekhawat18-lab.github.io/karni/assets/karni-suggestions.schema.json",
  "title": "karni suggest --json",
  "description": "Experimental. The output of karni suggest --json.",
  "$defs": {
    "_SuggestionOut": {
      "additionalProperties": false,
      "description": "One suggestion.",
      "properties": {
        "code": {
          "description": "The code, SUG001 to SUG007 (karni explain <code>).",
          "type": "string"
        },
        "rule": {
          "description": "The rule id a `# karni: allow(<rule>): <reason>` marker names to silence it.",
          "type": "string"
        },
        "file": {
          "description": "The file, relative to the project root.",
          "type": "string"
        },
        "line": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "The 1-based line, null when the whole file."
        },
        "message": {
          "description": "What the project does by hand.",
          "type": "string"
        },
        "fix": {
          "description": "The exact change or command.",
          "type": "string"
        },
        "command": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The command to run when the fix is one (karni remove charts), else null."
        }
      },
      "required": [
        "code",
        "rule",
        "file",
        "line",
        "message",
        "fix",
        "command"
      ],
      "type": "object"
    }
  },
  "additionalProperties": false,
  "properties": {
    "version": {
      "const": 1,
      "description": "The version of this output: 1.",
      "type": "integer"
    },
    "enabled": {
      "description": "false when the project turned suggestions off (KARNI_SUGGESTIONS = False).",
      "type": "boolean"
    },
    "suggestions": {
      "description": "The suggestions, by code, then file and line. They never fail a run.",
      "items": {
        "$ref": "#/$defs/_SuggestionOut"
      },
      "type": "array"
    },
    "problems": {
      "description": "Why the project's own suggestions are missing (its manage.py karni_suggest could not run, C780 or C781). Empty when nothing went wrong. A non-empty list means an empty `suggestions` is not a clean project.",
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "required": [
    "version",
    "enabled",
    "suggestions",
    "problems"
  ],
  "type": "object"
}
