{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/plainrouter/json-schema/plainrouter-cookie-declaration-schema.json",
  "title": "CookieDeclaration",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/plainrouter-cookiedeclaration-api-openapi.yml#/components/schemas/CookieDeclaration",
  "type": "object",
  "properties": {
    "scan_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Date of the latest completed scan; null when no scan has completed. Blocked and failed scans do not replace it."
    },
    "categories": {
      "type": "object",
      "properties": {
        "necessary": {
          "type": "object",
          "properties": {
            "cookies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            },
            "storage_keys": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            }
          },
          "required": [
            "cookies",
            "storage_keys"
          ]
        },
        "functional": {
          "type": "object",
          "properties": {
            "cookies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            },
            "storage_keys": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            }
          },
          "required": [
            "cookies",
            "storage_keys"
          ]
        },
        "analytics": {
          "type": "object",
          "properties": {
            "cookies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            },
            "storage_keys": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            }
          },
          "required": [
            "cookies",
            "storage_keys"
          ]
        },
        "marketing": {
          "type": "object",
          "properties": {
            "cookies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            },
            "storage_keys": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            }
          },
          "required": [
            "cookies",
            "storage_keys"
          ]
        },
        "unclassified": {
          "type": "object",
          "properties": {
            "cookies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            },
            "storage_keys": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CookieDeclarationItem"
              }
            }
          },
          "required": [
            "cookies",
            "storage_keys"
          ]
        }
      },
      "required": [
        "necessary",
        "functional",
        "analytics",
        "marketing",
        "unclassified"
      ]
    }
  },
  "required": [
    "scan_date",
    "categories"
  ],
  "$defs": {
    "CookieDeclarationItem": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "provider_domain": {
          "type": "string"
        },
        "party": {
          "type": "string",
          "enum": [
            "first",
            "third"
          ]
        },
        "expiry": {
          "type": "string",
          "description": "Observed UTC expiry date, Session, or Until removed."
        },
        "purpose": {
          "type": [
            "string",
            "null"
          ],
          "description": "Purpose from the Open Cookie Database, where available."
        }
      },
      "required": [
        "name",
        "provider_domain",
        "party",
        "expiry",
        "purpose"
      ],
      "title": "CookieDeclarationItem"
    }
  }
}