{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "schemaVersion": {
      "type": "number",
      "const": 1
    },
    "run": {
      "type": "object",
      "properties": {
        "tool": {
          "type": "string",
          "enum": [
            "cli",
            "action"
          ]
        },
        "mode": {
          "type": "string",
          "enum": [
            "check",
            "write"
          ]
        },
        "cliVersion": {
          "type": "string",
          "description": "The version of the engine and the command line that made the plan."
        },
        "actionVersion": {
          "type": [
            "string",
            "null"
          ]
        },
        "repository": {
          "description": "owner/name on GitHub.",
          "type": [
            "string",
            "null"
          ]
        },
        "sha": {
          "type": [
            "string",
            "null"
          ]
        },
        "ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "event": {
          "description": "The GitHub event, such as pull_request or push.",
          "type": [
            "string",
            "null"
          ]
        },
        "runUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "settings": {
          "description": "The settings file, from the repository root.",
          "type": [
            "string",
            "null"
          ]
        },
        "codeOwners": {
          "description": "The CODEOWNERS file read, from the repository root, or null when there is none.",
          "type": [
            "string",
            "null"
          ]
        },
        "since": {
          "description": "The git ref only changed sources were run against, or null for every source.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "tool",
        "mode",
        "cliVersion",
        "actionVersion",
        "repository",
        "sha",
        "ref",
        "event",
        "runUrl",
        "settings",
        "codeOwners",
        "since"
      ],
      "additionalProperties": false
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "description": "The importer, such as terraform or openapi."
          },
          "from": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The patterns the source names, as written."
          },
          "inputs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The files the patterns matched, from the repository root."
          },
          "out": {
            "type": "string",
            "description": "The diagram, from the repository root: a .diagram file, or file.md#fence-id."
          },
          "overrides": {
            "type": "string",
            "description": "The overrides file, from the repository root, whether or not it exists."
          },
          "status": {
            "type": "string",
            "enum": [
              "in-step",
              "drifted",
              "written",
              "failed"
            ],
            "description": "in-step: the files make the diagram that is committed. drifted: they make another (check mode). written: they made another and it was written (write mode). failed: an error stopped the source."
          },
          "summary": {
            "type": "string",
            "description": "The changes in one sentence per kind, or empty."
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "subject": {
                  "type": "string",
                  "description": "What changed: node, group, edge, table, column, header, and the other subjects of compare_diagrams."
                },
                "name": {
                  "type": "string",
                  "description": "Its id, its label in quotes, or for an edge its ends."
                },
                "change": {
                  "type": "string",
                  "description": "added, removed, renamed, moved, or changed."
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "subject",
                "name",
                "change",
                "detail"
              ],
              "additionalProperties": false
            }
          },
          "counts": {
            "type": "object",
            "properties": {
              "nodes": {
                "type": "object",
                "properties": {
                  "added": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "removed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "changed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Renamed, moved, or with other options."
                  }
                },
                "required": [
                  "added",
                  "removed",
                  "changed"
                ],
                "additionalProperties": false
              },
              "edges": {
                "type": "object",
                "properties": {
                  "added": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "removed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "changed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Renamed, moved, or with other options."
                  }
                },
                "required": [
                  "added",
                  "removed",
                  "changed"
                ],
                "additionalProperties": false
              },
              "changes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "errors": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "warnings": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "nodes",
              "edges",
              "changes",
              "errors",
              "warnings"
            ],
            "additionalProperties": false
          },
          "problems": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "description": "The Plotwork code, such as S201."
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "error",
                    "warning"
                  ]
                },
                "file": {
                  "type": "string",
                  "description": "From the repository root."
                },
                "line": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "column": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "message": {
                  "type": "string"
                },
                "hint": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "code",
                "severity",
                "file",
                "line",
                "column",
                "message",
                "hint"
              ],
              "additionalProperties": false
            },
            "description": "The source's errors and warnings, stale overrides (S201) among them."
          },
          "owners": {
            "type": "object",
            "properties": {
              "out": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The CODEOWNERS owners of the diagram file."
              },
              "sources": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The CODEOWNERS owners of the files it is made from, each once."
              }
            },
            "required": [
              "out",
              "sources"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "format",
          "from",
          "inputs",
          "out",
          "overrides",
          "status",
          "summary",
          "changes",
          "counts",
          "problems",
          "owners"
        ],
        "additionalProperties": false
      }
    },
    "unchanged": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The sources not run because nothing they read changed since `run.since`."
    },
    "problems": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The Plotwork code, such as S201."
          },
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning"
            ]
          },
          "file": {
            "type": "string",
            "description": "From the repository root."
          },
          "line": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "column": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "message": {
            "type": "string"
          },
          "hint": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "code",
          "severity",
          "file",
          "line",
          "column",
          "message",
          "hint"
        ],
        "additionalProperties": false
      },
      "description": "Problems of the settings themselves, such as two sources that write one file."
    },
    "totals": {
      "type": "object",
      "properties": {
        "sources": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "inStep": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "drifted": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991,
          "description": "Drifted in check mode, or written in write mode."
        },
        "failed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "errors": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "warnings": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "sources",
        "inStep",
        "drifted",
        "failed",
        "errors",
        "warnings"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "run",
    "sources",
    "unchanged",
    "problems",
    "totals"
  ],
  "additionalProperties": false,
  "description": "A run of plotwork generate: what each source made, what changed by meaning, its problems, and who owns it.",
  "$id": "https://docs.plotwork.dev/schemas/plotwork.report.json",
  "title": "Plotwork generate report"
}
