{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/forecall-dev/json-schema/forecall-dev-saved-lint-schema.json",
  "title": "SavedLint",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/forecall-dev-openapi.json#/components/schemas/SavedLint",
  "type": "object",
  "properties": {
    "server": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "slug",
        "name"
      ]
    },
    "version": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "created": {
          "type": "boolean",
          "description": "False when the tools matched the latest version"
        },
        "capturedAt": {
          "type": "string",
          "format": "date-time"
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "created",
        "capturedAt",
        "label"
      ]
    },
    "lint": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "report": {
          "$ref": "#/$defs/LintReport"
        }
      },
      "required": [
        "id",
        "report"
      ]
    },
    "changes": {
      "oneOf": [
        {
          "$ref": "#/$defs/VersionDiff"
        },
        {
          "type": "null"
        }
      ],
      "description": "Null when there is no version before, or it has no lint"
    },
    "units": {
      "type": "object",
      "properties": {
        "fromIncluded": {
          "type": "integer"
        },
        "fromCredits": {
          "type": "integer"
        }
      },
      "required": [
        "fromIncluded",
        "fromCredits"
      ]
    }
  },
  "required": [
    "server",
    "version",
    "lint",
    "changes",
    "units"
  ],
  "$defs": {
    "LintReport": {
      "type": "object",
      "properties": {
        "lintVersion": {
          "type": "integer",
          "description": "The scoring rules' version"
        },
        "toolCount": {
          "type": "integer"
        },
        "scoreAvg": {
          "type": "number",
          "description": "Out of 100, one decimal"
        },
        "confusablePairsTotal": {
          "type": "integer"
        },
        "tools": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "score": {
                "type": "integer"
              },
              "components": {
                "type": "object",
                "description": "Points of each of the six items"
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            },
            "required": [
              "name",
              "score",
              "components",
              "issues"
            ]
          }
        },
        "serverIssues": {
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      },
      "required": [
        "lintVersion",
        "toolCount",
        "scoreAvg",
        "confusablePairsTotal",
        "tools",
        "serverIssues"
      ],
      "description": "The same report as the web linter's (scores and issue codes: forecall.dev/en/docs/reading-scores)"
    },
    "VersionDiff": {
      "type": "object",
      "properties": {
        "sameRules": {
          "type": "boolean",
          "description": "Scores compare only within one rules version"
        },
        "scoreAvg": {
          "type": "object",
          "properties": {
            "before": {
              "type": "number"
            },
            "after": {
              "type": "number"
            }
          },
          "required": [
            "before",
            "after"
          ]
        },
        "confusablePairsTotal": {
          "type": "object",
          "properties": {
            "before": {
              "type": "integer"
            },
            "after": {
              "type": "integer"
            }
          },
          "required": [
            "before",
            "after"
          ]
        },
        "added": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "score": {
                "type": "integer"
              }
            },
            "required": [
              "name",
              "score"
            ]
          }
        },
        "removed": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "score": {
                "type": "integer"
              }
            },
            "required": [
              "name",
              "score"
            ]
          }
        },
        "changed": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "serverIssuesResolved": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "serverIssuesAdded": {
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      },
      "required": [
        "sameRules",
        "scoreAvg",
        "confusablePairsTotal",
        "added",
        "removed",
        "changed",
        "serverIssuesResolved",
        "serverIssuesAdded"
      ],
      "description": "What changed from the version before: scores, tools added and removed, issues resolved and new, word diffs of descriptions and arguments"
    }
  }
}