Skip to content

Upload document schema

The upload document schema describes what witnyx upload prints on standard output in agent mode: what it sent to the hosted Witnyx service, whether the service recorded it, and what became of the failures remembered from earlier uploads. The hosted service is in development.

  • status is uploaded or not_uploaded. Read it, not the exit code: an upload that was not recorded exits with 0 unless --require-upload is given.
  • receipt holds the service’s ID for the deploy and its evidence entry. It is left out when the service’s answer could not be read; the upload still counts as recorded.
  • failure says why the upload was not recorded: reason, code, message, hint, and retryable, whether running the same command again unchanged may succeed.
  • failureRemembered says whether the failure was remembered in the cache folder, to be reported with the next upload that succeeds.
  • reportLeftOut says why the --report file was not sent. The software bill of materials (SBOM) went without it, and that is not a failure.
  • notes lists what else to tell the user.

The key is never in this document. Arguments that cannot be parsed give the error document instead, with exit code 2.

Its ID is https://witnyx.dev/schemas/upload/v1.json, and every upload document names it in its schema field. witnyx schema upload prints the copy bundled with the tool:

Terminal window
$ witnyx schema upload
"$id": "https://witnyx.dev/schemas/upload/v1.json",
"title": "Witnyx upload document, version 1",
upload-v1.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://witnyx.dev/schemas/upload/v1.json",
"title": "Witnyx upload document, version 1",
"description": "Printed on standard output by `witnyx upload` in agent mode (spec sections 9 and 12.2): what was sent to the hosted service, whether the service recorded it, and what became of the failures remembered from earlier uploads. Arguments that cannot be parsed give the error document instead (exit code 2). The key is never in this document.",
"type": "object",
"additionalProperties": false,
"required": ["schema", "status", "exitCode", "gapsSent", "notes"],
"properties": {
"schema": { "const": "https://witnyx.dev/schemas/upload/v1.json" },
"status": {
"description": "uploaded: the service recorded the upload. not_uploaded: it did not, and failure says why.",
"enum": ["uploaded", "not_uploaded"]
},
"exitCode": {
"description": "The exit code of the run: 0 when the service recorded the upload, or when it did not and --require-upload was not given; 2 when it did not and --require-upload was given.",
"enum": [0, 2]
},
"endpoint": {
"description": "The URL the upload was sent to, or would have been sent to. Left out when --timeout or --api-url was refused.",
"type": "string",
"pattern": "^https?://[^/?#@]+/api/v1/deploys$"
},
"environment": {
"description": "The value of --env. environment, event, commit and commitSource are left out until the key, --env and --event have all been accepted.",
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]{0,31}$"
},
"event": { "description": "The value of --event.", "enum": ["deploy", "release"] },
"commit": {
"description": "The commit sent with the upload, in lower case. Left out when there was none.",
"type": "string",
"pattern": "^[0-9a-f]{7,64}$"
},
"commitSource": {
"description": "Where the commit came from: --commit, or the name of the CI variable that held it, such as GITHUB_SHA.",
"type": "string",
"minLength": 1
},
"sbom": {
"description": "The SBOM, once it was read and parsed.",
"type": "object",
"additionalProperties": false,
"required": ["path", "sha256", "format", "componentCount"],
"properties": {
"path": { "description": "The path as given to --sbom. It is never sent.", "type": "string", "minLength": 1 },
"sha256": { "$ref": "#/$defs/sha256" },
"format": { "enum": ["cyclonedx", "spdx"] },
"componentCount": { "type": "integer", "minimum": 0 }
}
},
"report": {
"description": "The report, when it was sent with the SBOM.",
"type": "object",
"additionalProperties": false,
"required": ["path", "sha256"],
"properties": {
"path": { "description": "The path as given to --report. It is never sent.", "type": "string", "minLength": 1 },
"sha256": { "$ref": "#/$defs/sha256" }
}
},
"reportLeftOut": {
"description": "Present when --report was given but the report was not sent, because the service would have refused it. The SBOM was sent without it; this is never a failure.",
"type": "object",
"additionalProperties": false,
"required": ["path", "reason"],
"properties": {
"path": { "description": "The path as given to --report.", "type": "string", "minLength": 1 },
"reason": { "description": "Why it was left out, as one sentence that starts with the path.", "type": "string", "minLength": 1 }
}
},
"receipt": {
"description": "What the service answered when it recorded the upload. Left out when its answer could not be read; the upload still counts as recorded.",
"type": "object",
"additionalProperties": false,
"required": ["deploy", "service", "receivedAt", "evidenceSeq", "evidenceHash", "gapsRecorded"],
"properties": {
"deploy": { "description": "The ID of the deploy the service recorded.", "$ref": "#/$defs/uuid" },
"service": { "description": "The ID of the service the key belongs to.", "$ref": "#/$defs/uuid" },
"receivedAt": { "description": "When the service received the upload, by its own clock (UTC).", "$ref": "#/$defs/instant" },
"evidenceSeq": { "description": "The number of the deploy's entry on the evidence chain.", "type": "integer", "minimum": 1 },
"evidenceHash": { "description": "The hash of that entry.", "$ref": "#/$defs/sha256" },
"gapsRecorded": { "description": "How many earlier failures the service recorded with this upload.", "type": "integer", "minimum": 0 }
}
},
"failure": {
"description": "Why the service did not record the upload.",
"type": "object",
"additionalProperties": false,
"required": ["reason", "code", "message", "retryable"],
"properties": {
"reason": {
"description": "no_key: WITNYX_API_KEY is not set. bad_input: the key, --env, --event, --timeout or --api-url was refused. sbom: the SBOM is missing, too large or could not be read. network: the connection failed. timeout: the --timeout budget ran out. rate_limited: the key used up its uploads for the hour (HTTP 429). rejected: the service refused the upload with another 4xx answer. http_status: any other answer but 201, such as a 5xx. internal: a fault in witnyx.",
"enum": ["no_key", "bad_input", "sbom", "network", "timeout", "rate_limited", "rejected", "http_status", "internal"]
},
"code": {
"description": "The error code: WX-CONFIG for no_key and bad_input, WX-CONFIG or a WX-SBOM code for sbom, WX-UPLOAD for what the network or the service did, and WX-INTERNAL for internal.",
"enum": ["WX-CONFIG", "WX-SBOM-NOT-FOUND", "WX-SBOM-PARSE", "WX-SBOM-UNSUPPORTED", "WX-SBOM-EMPTY", "WX-UPLOAD", "WX-INTERNAL"]
},
"message": { "type": "string", "minLength": 1 },
"hint": { "description": "What to do about it.", "type": "string", "minLength": 1 },
"retryable": { "description": "Whether running again unchanged may succeed.", "type": "boolean" },
"httpStatus": { "description": "The status of the service's last answer, when there was one.", "type": "integer", "minimum": 100, "maximum": 999 },
"serviceCode": { "description": "The code in the service's error answer, when it gave one.", "type": "string", "pattern": "^[a-z_]{1,32}$" },
"serviceField": {
"description": "The field in the service's error answer, when it gave one: the metadata member it refused, such as gaps[0].reason.",
"type": "string",
"pattern": "^[A-Za-z0-9_.\\[\\]]{1,64}$"
}
},
"allOf": [
{
"if": { "properties": { "reason": { "enum": ["no_key", "bad_input"] } } },
"then": { "properties": { "code": { "const": "WX-CONFIG" } } }
},
{
"if": { "properties": { "reason": { "const": "sbom" } } },
"then": { "properties": { "code": { "enum": ["WX-CONFIG", "WX-SBOM-NOT-FOUND", "WX-SBOM-PARSE", "WX-SBOM-UNSUPPORTED", "WX-SBOM-EMPTY"] } } }
},
{
"if": { "properties": { "reason": { "enum": ["network", "timeout", "rate_limited", "rejected", "http_status"] } } },
"then": { "properties": { "code": { "const": "WX-UPLOAD" } } }
},
{
"if": { "properties": { "reason": { "const": "internal" } } },
"then": { "properties": { "code": { "const": "WX-INTERNAL" } } }
}
]
},
"gapsSent": {
"description": "How many remembered failures the last request carried: 0 when there were none, or when no request was attempted. It may count a request that never reached the service; the service recorded them only when status is uploaded.",
"type": "integer",
"minimum": 0,
"maximum": 100
},
"gapsPending": {
"description": "How many failures are still waiting to be reported after this run, this run's own failure included when it was remembered. Left out when the remembered failures could not be read, or when this key's file of them was left in place.",
"type": "integer",
"minimum": 0
},
"failureRemembered": {
"description": "Whether this run's failure was remembered, to be reported with the next upload that succeeds. Present exactly when status is not_uploaded.",
"type": "boolean"
},
"notes": {
"description": "What the person should know, a commit or a report that was left out, an answer of the service that could not be read or does not match what was sent, and what happened to the remembered failures. When the upload was not recorded, the last note says whether and where its failure is remembered.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
}
},
"dependentRequired": {
"commit": ["commitSource"],
"commitSource": ["commit"]
},
"allOf": [
{ "not": { "required": ["report", "reportLeftOut"] } },
{
"if": { "properties": { "status": { "const": "uploaded" } } },
"then": {
"required": ["endpoint", "environment", "event", "sbom"],
"properties": { "exitCode": { "const": 0 } },
"not": { "anyOf": [{ "required": ["failure"] }, { "required": ["failureRemembered"] }] }
},
"else": {
"required": ["failure", "failureRemembered"],
"not": { "required": ["receipt"] }
}
}
],
"$defs": {
"sha256": { "description": "A SHA-256 in lowercase hex.", "type": "string", "pattern": "^[0-9a-f]{64}$" },
"uuid": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" },
"instant": {
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$"
}
}
}

Witnyx is a record-keeping and workflow tool. It does not certify compliance. Nothing on this site is legal advice.