|
| 1 | +{ |
| 2 | + "$schema": "http://json-schema.org/draft-07/schema#", |
| 3 | + "$id": "https://raw.githubusercontent.com/simplecov-ruby/simplecov/main/schemas/coverage.schema.json", |
| 4 | + "title": "SimpleCov coverage.json", |
| 5 | + "description": "Schema for the coverage.json file emitted by SimpleCov's JSONFormatter. Versioned independently of the gem; non-breaking additions bump the minor segment of schema_version, breaking changes bump the major segment.", |
| 6 | + "type": "object", |
| 7 | + "required": ["meta", "total", "coverage", "groups", "errors"], |
| 8 | + "additionalProperties": false, |
| 9 | + "properties": { |
| 10 | + "meta": { |
| 11 | + "type": "object", |
| 12 | + "required": [ |
| 13 | + "schema_version", |
| 14 | + "simplecov_version", |
| 15 | + "command_name", |
| 16 | + "project_name", |
| 17 | + "timestamp", |
| 18 | + "root", |
| 19 | + "branch_coverage", |
| 20 | + "method_coverage" |
| 21 | + ], |
| 22 | + "additionalProperties": false, |
| 23 | + "properties": { |
| 24 | + "schema_version": { |
| 25 | + "type": "string", |
| 26 | + "pattern": "^\\d+\\.\\d+$", |
| 27 | + "description": "Schema major.minor. Additive changes bump minor; breaking changes bump major." |
| 28 | + }, |
| 29 | + "simplecov_version": { |
| 30 | + "type": "string", |
| 31 | + "description": "The version of the SimpleCov gem that produced this file." |
| 32 | + }, |
| 33 | + "command_name": {"type": "string"}, |
| 34 | + "project_name": {"type": "string"}, |
| 35 | + "timestamp": { |
| 36 | + "type": "string", |
| 37 | + "format": "date-time", |
| 38 | + "description": "ISO 8601 timestamp with millisecond precision." |
| 39 | + }, |
| 40 | + "root": { |
| 41 | + "type": "string", |
| 42 | + "description": "Absolute path to SimpleCov.root at the time of write." |
| 43 | + }, |
| 44 | + "branch_coverage": {"type": "boolean"}, |
| 45 | + "method_coverage": {"type": "boolean"} |
| 46 | + } |
| 47 | + }, |
| 48 | + "total": {"$ref": "#/definitions/totals"}, |
| 49 | + "coverage": { |
| 50 | + "type": "object", |
| 51 | + "description": "Map of project-relative file paths to per-file coverage data.", |
| 52 | + "additionalProperties": {"$ref": "#/definitions/source_file"} |
| 53 | + }, |
| 54 | + "groups": { |
| 55 | + "type": "object", |
| 56 | + "description": "Map of group names to per-group totals plus the list of files in the group.", |
| 57 | + "additionalProperties": {"$ref": "#/definitions/group"} |
| 58 | + }, |
| 59 | + "errors": { |
| 60 | + "type": "object", |
| 61 | + "description": "Threshold violations from minimum_coverage, minimum_coverage_by_file, minimum_coverage_by_group, and maximum_coverage_drop. Empty object when no thresholds were violated.", |
| 62 | + "additionalProperties": false, |
| 63 | + "properties": { |
| 64 | + "minimum_coverage": { |
| 65 | + "type": "object", |
| 66 | + "description": "Keyed by criterion: lines, branches, methods.", |
| 67 | + "additionalProperties": {"$ref": "#/definitions/expected_actual"} |
| 68 | + }, |
| 69 | + "minimum_coverage_by_file": { |
| 70 | + "type": "object", |
| 71 | + "description": "Keyed by criterion, then by project-relative filename.", |
| 72 | + "additionalProperties": { |
| 73 | + "type": "object", |
| 74 | + "additionalProperties": {"$ref": "#/definitions/expected_actual"} |
| 75 | + } |
| 76 | + }, |
| 77 | + "minimum_coverage_by_group": { |
| 78 | + "type": "object", |
| 79 | + "description": "Keyed by group name, then by criterion.", |
| 80 | + "additionalProperties": { |
| 81 | + "type": "object", |
| 82 | + "additionalProperties": {"$ref": "#/definitions/expected_actual"} |
| 83 | + } |
| 84 | + }, |
| 85 | + "maximum_coverage_drop": { |
| 86 | + "type": "object", |
| 87 | + "description": "Keyed by criterion: lines, branches, methods.", |
| 88 | + "additionalProperties": {"$ref": "#/definitions/maximum_actual"} |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | + }, |
| 93 | + "definitions": { |
| 94 | + "totals": { |
| 95 | + "type": "object", |
| 96 | + "required": ["lines"], |
| 97 | + "additionalProperties": false, |
| 98 | + "properties": { |
| 99 | + "lines": {"$ref": "#/definitions/line_statistic"}, |
| 100 | + "branches": {"$ref": "#/definitions/coverage_statistic"}, |
| 101 | + "methods": {"$ref": "#/definitions/coverage_statistic"} |
| 102 | + } |
| 103 | + }, |
| 104 | + "source_file": { |
| 105 | + "type": "object", |
| 106 | + "required": ["lines", "source", "lines_covered_percent", "covered_lines", "missed_lines", "total_lines"], |
| 107 | + "additionalProperties": false, |
| 108 | + "properties": { |
| 109 | + "lines": { |
| 110 | + "type": "array", |
| 111 | + "description": "Per-source-line coverage. Element index N corresponds to source line N+1. Integer hit-count, null for non-relevant (blank/comment) lines, or the string \"ignored\" for lines inside a simplecov:disable / :nocov: region.", |
| 112 | + "items": {"$ref": "#/definitions/line_coverage"} |
| 113 | + }, |
| 114 | + "source": { |
| 115 | + "type": "array", |
| 116 | + "description": "Source lines, in order. Same length as the lines array.", |
| 117 | + "items": {"type": "string"} |
| 118 | + }, |
| 119 | + "lines_covered_percent": {"type": "number"}, |
| 120 | + "covered_lines": {"type": "integer", "minimum": 0}, |
| 121 | + "missed_lines": {"type": "integer", "minimum": 0}, |
| 122 | + "total_lines": {"type": "integer", "minimum": 0}, |
| 123 | + "branches": { |
| 124 | + "type": "array", |
| 125 | + "items": {"$ref": "#/definitions/branch"} |
| 126 | + }, |
| 127 | + "branches_covered_percent": {"type": "number"}, |
| 128 | + "covered_branches": {"type": "integer", "minimum": 0}, |
| 129 | + "missed_branches": {"type": "integer", "minimum": 0}, |
| 130 | + "total_branches": {"type": "integer", "minimum": 0}, |
| 131 | + "methods": { |
| 132 | + "type": "array", |
| 133 | + "items": {"$ref": "#/definitions/method"} |
| 134 | + }, |
| 135 | + "methods_covered_percent": {"type": "number"}, |
| 136 | + "covered_methods": {"type": "integer", "minimum": 0}, |
| 137 | + "missed_methods": {"type": "integer", "minimum": 0}, |
| 138 | + "total_methods": {"type": "integer", "minimum": 0} |
| 139 | + } |
| 140 | + }, |
| 141 | + "branch": { |
| 142 | + "type": "object", |
| 143 | + "required": ["type", "start_line", "end_line", "coverage", "inline", "report_line"], |
| 144 | + "additionalProperties": false, |
| 145 | + "properties": { |
| 146 | + "type": { |
| 147 | + "type": "string", |
| 148 | + "description": "Branch kind from Ruby's Coverage library (e.g. \"then\", \"else\", \"when\")." |
| 149 | + }, |
| 150 | + "start_line": {"type": "integer", "minimum": 1}, |
| 151 | + "end_line": {"type": "integer", "minimum": 1}, |
| 152 | + "coverage": {"$ref": "#/definitions/line_coverage"}, |
| 153 | + "inline": {"type": "boolean"}, |
| 154 | + "report_line": {"type": "integer", "minimum": 1} |
| 155 | + } |
| 156 | + }, |
| 157 | + "method": { |
| 158 | + "type": "object", |
| 159 | + "required": ["name", "start_line", "end_line", "coverage"], |
| 160 | + "additionalProperties": false, |
| 161 | + "properties": { |
| 162 | + "name": { |
| 163 | + "type": "string", |
| 164 | + "description": "Qualified method name, e.g. \"Foo#bar\", \"Foo.bar\", or \"Foo::Bar#baz\"." |
| 165 | + }, |
| 166 | + "start_line": {"type": "integer", "minimum": 1}, |
| 167 | + "end_line": {"type": "integer", "minimum": 1}, |
| 168 | + "coverage": {"$ref": "#/definitions/line_coverage"} |
| 169 | + } |
| 170 | + }, |
| 171 | + "group": { |
| 172 | + "type": "object", |
| 173 | + "required": ["lines", "files"], |
| 174 | + "additionalProperties": false, |
| 175 | + "properties": { |
| 176 | + "lines": {"$ref": "#/definitions/line_statistic"}, |
| 177 | + "branches": {"$ref": "#/definitions/coverage_statistic"}, |
| 178 | + "methods": {"$ref": "#/definitions/coverage_statistic"}, |
| 179 | + "files": { |
| 180 | + "type": "array", |
| 181 | + "description": "Project-relative paths of the files that fell into this group.", |
| 182 | + "items": {"type": "string"} |
| 183 | + } |
| 184 | + } |
| 185 | + }, |
| 186 | + "line_statistic": { |
| 187 | + "type": "object", |
| 188 | + "required": ["covered", "missed", "omitted", "total", "percent", "strength"], |
| 189 | + "additionalProperties": false, |
| 190 | + "properties": { |
| 191 | + "covered": {"type": "integer", "minimum": 0}, |
| 192 | + "missed": {"type": "integer", "minimum": 0}, |
| 193 | + "omitted": { |
| 194 | + "type": "integer", |
| 195 | + "minimum": 0, |
| 196 | + "description": "Lines that cannot be covered (blank, comment, etc.). Only present on line stats." |
| 197 | + }, |
| 198 | + "total": {"type": "integer", "minimum": 0}, |
| 199 | + "percent": {"type": "number"}, |
| 200 | + "strength": {"type": "number"} |
| 201 | + } |
| 202 | + }, |
| 203 | + "coverage_statistic": { |
| 204 | + "type": "object", |
| 205 | + "required": ["covered", "missed", "total", "percent", "strength"], |
| 206 | + "additionalProperties": false, |
| 207 | + "properties": { |
| 208 | + "covered": {"type": "integer", "minimum": 0}, |
| 209 | + "missed": {"type": "integer", "minimum": 0}, |
| 210 | + "total": {"type": "integer", "minimum": 0}, |
| 211 | + "percent": {"type": "number"}, |
| 212 | + "strength": {"type": "number"} |
| 213 | + } |
| 214 | + }, |
| 215 | + "line_coverage": { |
| 216 | + "description": "Integer hit-count for executable lines/branches/methods, null for non-relevant lines, or the literal string \"ignored\" for code inside a simplecov:disable region.", |
| 217 | + "oneOf": [ |
| 218 | + {"type": "integer", "minimum": 0}, |
| 219 | + {"type": "null"}, |
| 220 | + {"type": "string", "const": "ignored"} |
| 221 | + ] |
| 222 | + }, |
| 223 | + "expected_actual": { |
| 224 | + "type": "object", |
| 225 | + "required": ["expected", "actual"], |
| 226 | + "additionalProperties": false, |
| 227 | + "properties": { |
| 228 | + "expected": {"type": "number"}, |
| 229 | + "actual": {"type": "number"} |
| 230 | + } |
| 231 | + }, |
| 232 | + "maximum_actual": { |
| 233 | + "type": "object", |
| 234 | + "required": ["maximum", "actual"], |
| 235 | + "additionalProperties": false, |
| 236 | + "properties": { |
| 237 | + "maximum": {"type": "number"}, |
| 238 | + "actual": {"type": "number"} |
| 239 | + } |
| 240 | + } |
| 241 | + } |
| 242 | +} |
0 commit comments