{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.ndepend.com/schemas/issues-export/1.0.json",
  "title": "NDepend issues export",
  "description": "JSON written by NDepend.Console.exe /QualityGateCheck /OutJson (the quality gates status, the rules violated and the issues) and by NDepend.Console.exe /IssueCheck /OutJson (the rules violated and the issues, all issues or the issues of a rule or of a query, the quality gates are not evaluated). Version 1.x only adds properties, a breaking change bumps the major version and the schema URL.",
  "type": "object",
  "required": [ "schemaVersion", "tool", "project", "analysisDate", "baseline", "issuesQuery", "status", "summary", "qualityGates", "rules", "issues" ],
  "properties": {
    "$schema": {
      "description": "URL of the present JSON schema.",
      "type": "string"
    },
    "schemaVersion": {
      "description": "Version of the JSON format, like \"1.0\".",
      "type": "string"
    },
    "tool": {
      "type": "object",
      "required": [ "name", "version" ],
      "properties": {
        "name": { "description": "Always \"NDepend\".", "type": "string" },
        "version": { "description": "NDepend version that produced the file.", "type": "string" }
      }
    },
    "project": {
      "type": "object",
      "required": [ "name", "filePath" ],
      "properties": {
        "name": { "description": "NDepend project name.", "type": "string" },
        "filePath": { "description": "Absolute path of the .ndproj project file.", "type": "string" }
      }
    },
    "analysisDate": {
      "description": "Date of the analysis, ISO 8601 with time zone offset.",
      "type": "string",
      "format": "date-time"
    },
    "baseline": {
      "description": "The baseline the analysis is compared with, or null when there is no baseline. On a first analysis the baseline is the analysis itself: no issue is new.",
      "type": [ "object", "null" ],
      "required": [ "description", "date" ],
      "properties": {
        "description": { "description": "Human readable description of the baseline.", "type": [ "string", "null" ] },
        "date": { "description": "Date of the baseline analysis, ISO 8601, or null if unknown.", "type": [ "string", "null" ], "format": "date-time" }
      }
    },
    "issuesQuery": {
      "description": "/IssueCheck \"rule or query\": the name of the rule or of the query whose issues are exported. null with /QualityGateCheck and with /IssueCheck without value (all issues).",
      "type": [ "string", "null" ]
    },
    "status": {
      "description": "Worst status among all quality gates. With /QualityGateCheck the exit code is 2 when Fail, 0 otherwise (unless /ForceReturnZeroExitCode). null with /IssueCheck: the quality gates are not evaluated.",
      "type": [ "string", "null" ],
      "enum": [ "Pass", "Warn", "Fail", null ]
    },
    "summary": {
      "type": "object",
      "required": [ "qualityGatesCount", "qualityGatesFailCount", "qualityGatesWarnCount", "rulesViolatedCount", "issuesCount", "newIssuesCount", "fixedIssuesCount" ],
      "properties": {
        "qualityGatesCount": { "description": "null with /IssueCheck.", "type": [ "integer", "null" ], "minimum": 0 },
        "qualityGatesFailCount": { "description": "null with /IssueCheck.", "type": [ "integer", "null" ], "minimum": 0 },
        "qualityGatesWarnCount": { "description": "null with /IssueCheck.", "type": [ "integer", "null" ], "minimum": 0 },
        "rulesViolatedCount": { "description": "Number of rules with at least one issue, same as the length of the rules array.", "type": "integer", "minimum": 0 },
        "issuesCount": { "description": "Number of issues, same as the length of the issues array.", "type": "integer", "minimum": 0 },
        "newIssuesCount": { "description": "Issues introduced since the baseline, null when there is no baseline.", "type": [ "integer", "null" ], "minimum": 0 },
        "fixedIssuesCount": { "description": "Issues of the baseline fixed since then, null when there is no baseline and with /IssueCheck. Fixed issues are not listed in the issues array.", "type": [ "integer", "null" ], "minimum": 0 }
      }
    },
    "qualityGates": {
      "description": "null with /IssueCheck: the quality gates are not evaluated.",
      "type": [ "array", "null" ],
      "items": {
        "type": "object",
        "required": [ "name", "status", "value", "valueString", "unit", "failThreshold", "warnThreshold", "moreIsBad" ],
        "properties": {
          "name": { "type": "string" },
          "status": { "$ref": "#/$defs/qualityGateStatus" },
          "value": { "description": "Quality gate value, null when it cannot be computed (then the quality gate passes).", "type": [ "number", "null" ] },
          "valueString": { "description": "Value formatted with its unit.", "type": "string" },
          "unit": { "type": "string" },
          "failThreshold": { "type": "number" },
          "warnThreshold": { "description": "null when the quality gate has no warn threshold.", "type": [ "number", "null" ] },
          "moreIsBad": { "description": "true when a higher value means a worse quality.", "type": "boolean" }
        }
      }
    },
    "rules": {
      "description": "Rules that have at least one issue. Sorted in order of first appearance in the issues array.",
      "type": "array",
      "items": {
        "type": "object",
        "required": [ "id", "name", "category", "provider", "isCritical", "issuesCount", "description", "howToFix", "helpUri" ],
        "properties": {
          "id": { "description": "Rule id like ND1000. For a rule without id (like a rule declared in source code) the rule name.", "type": "string" },
          "name": { "type": "string" },
          "category": { "description": "Group of the rule, can be empty.", "type": "string" },
          "provider": { "description": "CodeQueryRule for an NDepend CQLinq rule, Roslyn or Resharper for an imported issue.", "type": "string", "enum": [ "CodeQueryRule", "Roslyn", "Resharper" ] },
          "isCritical": { "type": "boolean" },
          "issuesCount": { "type": "integer", "minimum": 1 },
          "description": { "description": "Rule description in Markdown, null if none.", "type": [ "string", "null" ] },
          "howToFix": { "description": "How to fix issues of the rule, in Markdown with code samples, null if none.", "type": [ "string", "null" ] },
          "helpUri": { "description": "Online documentation of an NDepend default rule, null for other rules.", "type": [ "string", "null" ], "format": "uri" }
        }
      }
    },
    "issues": {
      "description": "Issues of the analysis (with /IssueCheck \"rule or query\" only the issues of the rule or of the query), suppressed issues excluded. Sorted by severity (highest first), then new issues first, then by rule and location.",
      "type": "array",
      "items": {
        "type": "object",
        "required": [ "ruleId", "severity", "isNew", "codeElement", "isTestCode", "sourceFile", "line", "column", "explanation", "debt", "debtMinutes", "annualInterest" ],
        "properties": {
          "ruleId": { "description": "Id of the rule in the rules array.", "type": "string" },
          "severity": { "type": "string", "enum": [ "Blocker", "Critical", "High", "Medium", "Low" ] },
          "isNew": { "description": "true if the issue has been introduced since the baseline, null when there is no baseline.", "type": [ "boolean", "null" ] },
          "codeElement": { "description": "Full name of the code element (assembly, namespace, type, method, field...) the issue is about.", "type": "string" },
          "isTestCode": { "type": "boolean" },
          "sourceFile": { "description": "Absolute path of the source file, null when unknown.", "type": [ "string", "null" ] },
          "line": { "description": "1-based line in sourceFile, null when sourceFile is null, 0 if unknown.", "type": [ "integer", "null" ], "minimum": 0 },
          "column": { "description": "1-based column in sourceFile, null when sourceFile is null, 0 if unknown.", "type": [ "integer", "null" ], "minimum": 0 },
          "explanation": { "description": "Why the code element violates the rule, null if the rule provides none.", "type": [ "string", "null" ] },
          "debt": { "description": "Estimated cost to fix the issue, formatted.", "type": "string" },
          "debtMinutes": { "description": "Estimated cost to fix the issue in minutes.", "type": "number", "minimum": 0 },
          "annualInterest": { "description": "Estimated yearly cost of leaving the issue unfixed, formatted.", "type": "string" }
        }
      }
    }
  },
  "$defs": {
    "qualityGateStatus": {
      "type": "string",
      "enum": [ "Pass", "Warn", "Fail" ]
    }
  }
}
