{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pageaudit/json-schema/pageaudit-patch-schema.json",
  "title": "Patch",
  "description": "The consolidated patch of an audit, ready for the agent that builds the site to apply.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pageaudit-audits-api-openapi.yml#/components/schemas/Patch",
  "type": "object",
  "properties": {
    "url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Final audited URL."
    },
    "audit": {
      "type": [
        "string",
        "null"
      ],
      "description": "Absolute link of the source audit."
    },
    "head": {
      "type": "string",
      "description": "The deterministic tags, one per line, in <head> order (charset first). Empty when there are none."
    },
    "arquivos": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ArquivoPatch"
      },
      "description": "Files to create at the host root."
    },
    "moldes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MoldePatch"
      },
      "description": "What only the owner can fill in."
    },
    "sem_patch": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SemPatch"
      },
      "description": "What is a decision or infrastructure."
    },
    "resumo": {
      "allOf": [
        {
          "$ref": "#/$defs/ResumoPatch"
        }
      ],
      "description": "Count per class."
    },
    "como_aplicar": {
      "type": "string",
      "description": "One-sentence instruction."
    },
    "_links": {
      "type": "object",
      "description": "`api_index`."
    }
  },
  "required": [
    "url",
    "audit",
    "head",
    "arquivos",
    "moldes",
    "sem_patch",
    "resumo",
    "como_aplicar",
    "_links"
  ],
  "$defs": {
    "ArquivoPatch": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "Finding that originated it (`robots_txt_missing`, `sitemap_missing`)."
        },
        "path": {
          "type": "string",
          "description": "Absolute path on the host, e.g. `/robots.txt`."
        },
        "conteudo": {
          "type": "string",
          "description": "Full content of the file."
        }
      },
      "required": [
        "code",
        "path",
        "conteudo"
      ],
      "description": "A file to create at the host root."
    },
    "MoldePatch": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "Source finding."
        },
        "alvo": {
          "type": "string",
          "description": "`head`, `corpo` or `img`."
        },
        "snippet": {
          "type": "string",
          "description": "The tag with `{{PLACEHOLDER}}`."
        },
        "fonte": {
          "type": [
            "string",
            "null"
          ],
          "description": "Suggestion taken from the page itself (H1, og:description…), if any."
        },
        "nota": {
          "type": "string",
          "description": "What to fill in and the limit."
        }
      },
      "required": [
        "code",
        "alvo",
        "snippet",
        "fonte",
        "nota"
      ],
      "description": "A tag with a marked placeholder: content missing that only the owner knows."
    },
    "ResumoPatch": {
      "type": "object",
      "properties": {
        "deterministicos": {
          "type": "integer",
          "description": "Ready to paste (head + files)."
        },
        "moldes": {
          "type": "integer",
          "description": "With a placeholder."
        },
        "sem_patch": {
          "type": "integer",
          "description": "Instruction only."
        },
        "total": {
          "type": "integer",
          "description": "Findings considered."
        }
      },
      "required": [
        "deterministicos",
        "moldes",
        "sem_patch",
        "total"
      ],
      "description": "How many fixes of each class."
    },
    "SemPatch": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "Source finding."
        },
        "nota": {
          "type": "string",
          "description": "What to check or decide."
        }
      },
      "required": [
        "code",
        "nota"
      ],
      "description": "Finding without an automatic fix: it is a decision or infrastructure."
    }
  }
}