{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://rockytested.com/skills/schema.json",
 "title": "Rocky Tested per-skill score",
 "type": "object",
 "additionalProperties": false,
 "required": [
  "schema_version",
  "review_slug",
  "repo",
  "skill_id",
  "name",
  "status",
  "passes_bar"
 ],
 "properties": {
  "schema_version": {
   "const": 1
  },
  "review_slug": {
   "type": "string",
   "description": "Rocky Tested review slug, matching data/skills/<review_slug>/"
  },
  "repo": {
   "type": "string",
   "description": "GitHub owner/name at the tested commit"
  },
  "skill_id": {
   "type": "string",
   "description": "Stable id, usually the skill name slug"
  },
  "name": {
   "type": "string"
  },
  "path": {
   "type": "string",
   "description": "Skill folder relative to the repo root"
  },
  "commit": {
   "type": "string"
  },
  "domain": {
   "type": "string"
  },
  "status": {
   "enum": [
    "unscreened",
    "screened",
    "ab_tested",
    "excluded"
   ]
  },
  "passes_bar": {
   "type": "boolean",
   "description": "True only when the bar rules in SCHEMA.md all hold. Never set true without scores."
  },
  "bar_reason": {
   "type": "string"
  },
  "license": {
   "type": "object",
   "additionalProperties": false,
   "required": [
    "spdx"
   ],
   "properties": {
    "spdx": {
     "type": "string"
    },
    "credit": {
     "type": "string",
     "description": "Copyright line to keep with any Rocky picks pack"
    },
    "url": {
     "type": "string"
    }
   }
  },
  "scores": {
   "oneOf": [
    {
     "type": "null"
    },
    {
     "type": "object",
     "additionalProperties": false,
     "properties": {
      "commit": {
       "type": "string"
      },
      "job_id": {
       "type": "integer"
      },
      "cases": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "id",
         "task",
         "with_skill",
         "without_skill"
        ],
        "properties": {
         "id": {
          "type": "string"
         },
         "task": {
          "type": "string"
         },
         "with_skill": {
          "enum": [
           "pass",
           "fail",
           "partial"
          ]
         },
         "without_skill": {
          "enum": [
           "pass",
           "fail",
           "partial"
          ]
         },
         "notes": {
          "type": "string"
         }
        }
       }
      },
      "uplift": {
       "type": "object",
       "properties": {
        "with_pass": {
         "type": "integer"
        },
        "without_pass": {
         "type": "integer"
        },
        "n_cases": {
         "type": "integer"
        },
        "delta": {
         "type": "number"
        }
       }
      },
      "safety_flags": {
       "type": "array",
       "items": {
        "type": "string"
       }
      },
      "notes": {
       "type": "string"
      }
     }
    }
   ]
  }
 }
}