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