{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/simonvanlierde/sourceledger/main/docs/report.schema.json", "title": "sourceledger --json report", "description": "The JSON object a stage prints under --json. An empty errors list requires the result fields for the stage. A report with errors can contain stage fields, such as the sources that completed before a fetch failed.", "type": "object", "properties": { "schema_version": {"const": 1}, "stage": {"enum": ["fetch", "record", "build", "validate", "status", "revisions", "verify", "release"]}, "errors": {"type": "array", "items": {"$ref": "#/$defs/error"}} }, "required": ["schema_version", "stage", "errors"], "oneOf": [ {"$ref": "#/$defs/fetch"}, {"$ref": "#/$defs/record"}, {"$ref": "#/$defs/build"}, {"$ref": "#/$defs/problems"}, {"$ref": "#/$defs/status"}, {"$ref": "#/$defs/revisions"}, {"$ref": "#/$defs/release"} ], "unevaluatedProperties": false, "$defs": { "error": { "type": "object", "properties": { "message": {"type": "string"}, "help": {"type": ["string", "null"]} }, "required": ["message", "help"], "additionalProperties": false }, "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, "logRecord": { "description": "A line of data/fetches.jsonl. `recorded_at` and `parameters` appear only for a file `record` took in.", "type": "object", "properties": { "source_id": {"type": "string"}, "url": {"type": "string"}, "retrieved_at": {"type": "string"}, "sha256": {"$ref": "#/$defs/sha256"}, "bytes": {"type": "integer", "minimum": 0}, "vintage": {"type": "string"}, "last_modified": {"type": "string"}, "etag": {"type": "string"}, "final_url": {"type": "string"}, "env_headers": {"type": "array", "items": {"type": "string"}}, "archive_url": {"type": "string"}, "recorded_at": {"type": "string"}, "parameters": {"type": "object", "additionalProperties": {"type": "string"}} }, "required": ["source_id", "url", "retrieved_at", "sha256", "bytes", "vintage", "last_modified", "etag", "final_url", "env_headers", "archive_url"] }, "fetchRecord": { "description": "A log line with `new` and `relogged`.", "allOf": [ {"$ref": "#/$defs/logRecord"}, { "properties": {"new": {"type": "boolean"}, "relogged": {"type": "boolean"}}, "required": ["new", "relogged"] } ], "unevaluatedProperties": false }, "validator": { "type": "object", "properties": { "file": {"type": "string"}, "name": {"type": "string"}, "version": {"type": "string"} }, "required": ["file", "name", "version"], "additionalProperties": false }, "fetch": { "properties": { "stage": {"const": "fetch"}, "dry_run": {"const": true}, "records": {"type": "array", "items": {"$ref": "#/$defs/fetchRecord"}}, "would_fetch": { "type": "array", "items": { "type": "object", "properties": {"source_id": {"type": "string"}, "url": {"type": "string"}}, "required": ["source_id", "url"], "additionalProperties": false } } }, "if": {"properties": {"errors": {"maxItems": 0}}}, "then": {"anyOf": [{"required": ["records"]}, {"required": ["dry_run", "would_fetch"]}]} }, "record": { "properties": { "stage": {"const": "record"}, "dry_run": {"const": true}, "records": {"type": "array", "items": {"$ref": "#/$defs/fetchRecord"}} }, "if": {"properties": {"errors": {"maxItems": 0}}}, "then": {"required": ["records"]} }, "build": { "properties": { "stage": {"const": "build"}, "dry_run": {"const": true}, "outputs": { "description": "The files written, in source order. `rows` is null for a file copied unchanged.", "type": "array", "items": { "type": "object", "properties": {"path": {"type": "string"}, "rows": {"type": ["integer", "null"], "minimum": 0}}, "required": ["path", "rows"], "additionalProperties": false } }, "package": {"description": "The path of the written datapackage.json.", "type": "string"}, "would_write": {"description": "With dry_run: the paths a build would write.", "type": "array", "items": {"type": "string"}} }, "if": {"properties": {"errors": {"maxItems": 0}}}, "then": { "if": {"required": ["dry_run"]}, "then": { "required": ["would_write"], "not": {"anyOf": [{"required": ["outputs"]}, {"required": ["package"]}]} }, "else": { "required": ["outputs", "package"], "not": {"required": ["would_write"]} } } }, "problems": { "description": "validate and verify: the problems found are a result, with exit code 1.", "properties": { "stage": {"enum": ["validate", "verify"]}, "problems": {"type": "array", "items": {"type": "string"}} }, "if": {"properties": {"errors": {"maxItems": 0}}}, "then": {"required": ["problems"]} }, "status": { "properties": { "stage": {"const": "status"}, "sources": { "type": "array", "items": { "type": "object", "properties": { "source_id": {"type": "string"}, "status": {"type": ["string", "null"]}, "vintage": {"type": ["string", "null"]}, "retrieved_at": {"type": ["string", "null"]}, "recorded_at": {"type": ["string", "null"]}, "sha256": {"oneOf": [{"$ref": "#/$defs/sha256"}, {"type": "null"}]}, "license": {"type": ["string", "null"]}, "redistribute": {"type": ["boolean", "null"]} }, "required": ["source_id", "status", "vintage", "retrieved_at", "recorded_at", "sha256", "license", "redistribute"], "additionalProperties": false } } }, "if": {"properties": {"errors": {"maxItems": 0}}}, "then": {"required": ["sources"]} }, "revisions": { "properties": { "stage": {"const": "revisions"}, "revisions": { "type": "array", "items": { "type": "object", "properties": { "source_id": {"type": "string"}, "before_sha256": {"$ref": "#/$defs/sha256"}, "after": {"$ref": "#/$defs/logRecord", "unevaluatedProperties": false} }, "required": ["source_id", "before_sha256", "after"], "additionalProperties": false } } }, "if": {"properties": {"errors": {"maxItems": 0}}}, "then": {"required": ["revisions"]} }, "release": { "description": "A written (or dry-run) release has files, excluded, formats and validators. A refused release, and `--check`, have problems and validators.", "properties": { "stage": {"const": "release"}, "dry_run": {"const": true}, "files": {"type": "array", "items": {"type": "string"}}, "excluded": {"type": "array", "items": {"type": "string"}}, "formats": {"type": "object", "additionalProperties": {"enum": ["written", "skipped"]}}, "validators": {"type": "array", "items": {"$ref": "#/$defs/validator"}}, "problems": {"type": "array", "items": {"type": "string"}} }, "if": {"properties": {"errors": {"maxItems": 0}}}, "then": {"anyOf": [{"required": ["files", "excluded", "formats", "validators"]}, {"required": ["problems", "validators"]}]} } } }