{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pageaudit/json-schema/pageaudit-audit-gravado-schema.json",
  "title": "AuditGravado",
  "description": "The same report re-read from the database. It has no `quota` and no `_links` (it is a read, not a run) and gains the date and the share slug.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pageaudit-audits-api-openapi.yml#/components/schemas/AuditGravado",
  "type": "object",
  "properties": {
    "audit_id": {
      "type": "string",
      "description": "ID of the audit."
    },
    "url": {
      "type": "string",
      "description": "Final audited URL, after following the redirects."
    },
    "score": {
      "type": "integer",
      "description": "Score from 0 to 100."
    },
    "summary": {
      "allOf": [
        {
          "$ref": "#/$defs/ResumoPagina"
        }
      ],
      "description": "What the page declared at the time of the run.",
      "nullable": true
    },
    "counts": {
      "allOf": [
        {
          "$ref": "#/$defs/ContagemAchados"
        }
      ],
      "description": "How many findings of each severity."
    },
    "issues": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Achado"
      },
      "description": "Everything found in that run."
    },
    "fixes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Correcao"
      },
      "description": "The ready fix of each finding; an audit stored before this existed gets the computation on read."
    },
    "jsonLd": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "The raw JSON-LD blocks stored."
    },
    "headers": {
      "type": "object",
      "description": "Headers of the target's response, as they were in the run."
    },
    "truncated": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "What was cut by size when storing."
    },
    "share_slug": {
      "type": [
        "string",
        "null"
      ],
      "description": "Public slug, if this audit was shared."
    },
    "created_at": {
      "type": "string",
      "description": "When the run happened (UTC)."
    }
  },
  "required": [
    "audit_id",
    "url",
    "score",
    "summary",
    "counts",
    "issues",
    "fixes",
    "jsonLd",
    "headers",
    "truncated",
    "share_slug",
    "created_at"
  ],
  "$defs": {
    "Achado": {
      "type": "object",
      "properties": {
        "severity": {
          "type": "string",
          "description": "Severity of the finding."
        },
        "code": {
          "type": "string",
          "description": "Stable check code, e.g. `title_missing`. It is what you filter by."
        },
        "message": {
          "type": "string",
          "description": "The finding in one sentence, ready to show a person."
        }
      },
      "required": [
        "severity",
        "code",
        "message"
      ],
      "description": "A problem (or a pass) found on the page."
    },
    "ContagemAchados": {
      "type": "object",
      "properties": {
        "errors": {
          "type": "integer",
          "description": "Serious findings."
        },
        "warnings": {
          "type": "integer",
          "description": "Findings that deserve attention."
        },
        "info": {
          "type": "integer",
          "description": "Observations without severity."
        }
      },
      "required": [
        "errors",
        "warnings",
        "info"
      ],
      "description": "How many findings of each severity — the summary that fits in a badge."
    },
    "Correcao": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "The same `code` as the finding (`Achado.code`)."
        },
        "severity": {
          "type": "string",
          "description": "Severity of the source finding."
        },
        "classe": {
          "type": "string",
          "description": "`deterministico` comes whole from the page; `molde` has a `{{…}}` placeholder; `sem_patch` is an instruction."
        },
        "alvo": {
          "type": "string",
          "description": "Where to apply: `head`, `corpo`, `img`, `arquivo` or `pagina` (instruction)."
        },
        "snippet": {
          "type": [
            "string",
            "null"
          ],
          "description": "The ready tag (or with a placeholder). `null` for files and for `sem_patch`."
        },
        "arquivo": {
          "type": [
            "object",
            "null"
          ],
          "description": "`path` and `conteudo` when the fix is a file at the host root."
        },
        "fonte": {
          "type": [
            "string",
            "null"
          ],
          "description": "Where the value came from, or what the page already had (for the template or to check the cut)."
        },
        "nota": {
          "type": [
            "string",
            "null"
          ],
          "description": "How to apply, or what to decide."
        }
      },
      "required": [
        "code",
        "severity",
        "classe",
        "alvo",
        "snippet",
        "arquivo",
        "fonte",
        "nota"
      ],
      "description": "The ready fix of one finding. `classe` says whether it is to paste, to fill in or to decide."
    },
    "ResumoPagina": {
      "type": "object",
      "properties": {
        "finalUrl": {
          "type": "string",
          "description": "URL after following every redirect."
        },
        "status": {
          "type": "integer",
          "description": "Final HTTP status of the target."
        },
        "contentType": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content-Type of the final response."
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<title>`."
        },
        "metaDescription": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<meta name=description>`."
        },
        "canonical": {
          "type": [
            "string",
            "null"
          ],
          "description": "Canonical URL declared by the page."
        },
        "robots": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<meta name=robots>`."
        },
        "viewport": {
          "type": [
            "string",
            "null"
          ],
          "description": "Content of `<meta name=viewport>`."
        },
        "charset": {
          "type": [
            "string",
            "null"
          ],
          "description": "Declared encoding."
        },
        "lang": {
          "type": [
            "string",
            "null"
          ],
          "description": "Language declared in `<html lang>`."
        },
        "favicon": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL of the favicon found."
        },
        "faviconSource": {
          "type": [
            "string",
            "null"
          ],
          "description": "How the favicon was found: declared or by the default path."
        },
        "h1s": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Every `<h1>` on the page, in order."
        },
        "openGraph": {
          "type": "object",
          "description": "The `og:*` tags found, key by key."
        },
        "twitter": {
          "type": "object",
          "description": "The `twitter:*` tags found."
        },
        "jsonLdCount": {
          "type": "integer",
          "description": "How many JSON-LD nodes the page had."
        },
        "jsonLdBlocks": {
          "type": "integer",
          "description": "How many `<script type=application/ld+json>` blocks existed."
        },
        "jsonLdDropped": {
          "type": "boolean",
          "description": "`true` when nodes were dropped for passing the cap."
        },
        "jsonLdTypes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The `@type`s found, e.g. `Organization`, `WebSite`."
        },
        "images": {
          "type": "object",
          "description": "Image count and how many have no `alt`."
        },
        "links": {
          "type": "object",
          "description": "Count of internal, external and text-less links."
        },
        "words": {
          "type": "integer",
          "description": "Words in the visible content."
        },
        "hreflang": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "The declared language alternates."
        },
        "legacy": {
          "type": "object",
          "description": "Old markup still present (e.g. `<font>`, layout tables)."
        },
        "redirects": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "The redirect chain followed to the final URL."
        },
        "robotsTxt": {
          "type": "object",
          "description": "What the origin's `robots.txt` says about this URL."
        },
        "sitemap": {
          "type": "object",
          "description": "Whether the URL appears in the sitemap the origin declares."
        }
      },
      "required": [
        "finalUrl",
        "status",
        "contentType",
        "title",
        "metaDescription",
        "canonical",
        "robots",
        "viewport",
        "charset",
        "lang",
        "favicon",
        "faviconSource",
        "h1s",
        "openGraph",
        "twitter",
        "jsonLdCount",
        "jsonLdBlocks",
        "jsonLdDropped",
        "jsonLdTypes",
        "images",
        "links",
        "words",
        "hreflang",
        "legacy",
        "redirects",
        "robotsTxt",
        "sitemap"
      ],
      "description": "Everything the page declares about itself. It is the most consulted object of the API."
    }
  }
}