{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/legivel-com/json-schema/legivel-com-render-json-delivery-schema.json",
  "title": "RenderJsonDelivery",
  "description": "The answer to `output: \"json\"`: the document and the numbers that describe it.",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/legivel-com-openapi.json#/components/schemas/RenderJsonDelivery",
  "type": "object",
  "properties": {
    "pdf": {
      "type": "string",
      "contentEncoding": "base64",
      "contentMediaType": "application/pdf",
      "description": "The document, Base64-encoded."
    },
    "pages": {
      "type": "integer",
      "minimum": 1,
      "description": "Pages in the document."
    },
    "bytes": {
      "type": "integer",
      "minimum": 0,
      "description": "Length of the decoded document in bytes."
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "description": "The SHA-256 of the exact bytes delivered, in lower-case hexadecimal. The document is hashed after any seal is applied, so the digest is of the file as saved."
    },
    "signed": {
      "type": "boolean",
      "description": "Whether a seal was applied and confirmed."
    },
    "standards": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The PDF standards the document meets, such as `PDF/A-4f` and `PDF/UA-2`. Empty when it claims none."
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/StandardsWarning"
      },
      "description": "What the converter did about the requested standards, or why it left one out. Empty when there is nothing to report."
    },
    "language": {
      "type": "string",
      "maxLength": 63,
      "description": "The document language the tagged PDF records, as a BCP 47 tag such as `en-GB`. Absent when the PDF is not tagged."
    },
    "language_source": {
      "type": "string",
      "enum": [
        "document",
        "detected",
        "default"
      ],
      "description": "Where `language` came from: `document` for the request's `language` or the front matter, `detected` for the main language of the text, `default` for `en` when the text does not show its language clearly. Absent with `language`."
    }
  },
  "required": [
    "pdf",
    "pages",
    "bytes",
    "sha256",
    "signed",
    "standards",
    "warnings"
  ],
  "additionalProperties": false,
  "$defs": {
    "StandardsWarning": {
      "type": "object",
      "title": "StandardsWarning",
      "description": "One thing the converter did about a PDF standard, or why it left one out. The documentation lists each code with its fix.",
      "properties": {
        "code": {
          "type": "string",
          "pattern": "^[a-z_]{1,64}$",
          "description": "The stable name of the warning, as `X-Legivel-Warnings` lists it."
        },
        "message": {
          "type": "string",
          "description": "One sentence of English that may be reworded at any time."
        },
        "detail": {
          "type": "object",
          "properties": {
            "count": {
              "type": "integer",
              "minimum": 0,
              "description": "How often the warning applied in the document."
            }
          },
          "required": [
            "count"
          ],
          "additionalProperties": false,
          "description": "What the converter counted, where it counts."
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": false
    }
  }
}