{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.aeriuspulse.com/developer/feed-v2.schema.json",
  "title": "Aerius Pulse article feed v2",
  "description": "Payloads of GET /api/v2/feed/articles, GET /api/v2/feed/articles/{id}, the 410 tombstone and webhook v2 bodies. v2 only adds fields; nothing is renamed or removed without v3 and 6 months' notice. Unknown fields must be ignored.",
  "$defs": {
    "link": { "type": "object", "required": ["text", "url"], "properties": { "text": { "type": "string" }, "url": { "type": "string", "format": "uri" } } },
    "variant": { "type": "object", "required": ["url", "width"], "properties": {
      "url": { "type": "string", "format": "uri" }, "width": { "type": "integer" }, "height": { "type": ["integer", "null"] },
      "type": { "const": "image/webp" }, "hash": { "type": "string" } } },
    "image": { "type": "object", "required": ["url", "alt"], "properties": {
      "url": { "type": "string", "format": "uri", "description": "Served from https://www.aeriuspulse.com/media/…" },
      "alt": { "type": "string" }, "width": { "type": ["integer", "null"] }, "height": { "type": ["integer", "null"] },
      "caption": { "type": ["string", "null"] }, "kind": { "enum": ["screenshot", "chart", "diagram", "illustration", "photo"] },
      "hash": { "type": "string" }, "role": { "enum": ["cover", "inline"] }, "index": { "type": "integer", "description": "0 = cover, 1..n in reading order" },
      "variants": { "type": "array", "items": { "$ref": "#/$defs/variant" } } } },
    "author": { "type": "object", "properties": { "name": { "type": ["string", "null"] }, "url": { "type": ["string", "null"] } } },
    "category": { "type": ["object", "null"], "required": ["id", "name"], "properties": { "id": { "type": "string" }, "name": { "type": "string" } },
      "description": "From the site's own category list (PUT /api/v2/site), or null. Never invented." },
    "summary": { "type": "object", "required": ["id", "version", "slug", "title", "status", "canonical_url"], "properties": {
      "id": { "type": "string", "format": "uuid", "description": "Never changes" },
      "version": { "type": "integer", "minimum": 1, "description": "Grows on every change" },
      "slug": { "type": "string" }, "previous_slugs": { "type": "array", "items": { "type": "string" }, "description": "301 these to the new slug" },
      "title": { "type": "string" }, "description": { "type": ["string", "null"] },
      "status": { "enum": ["published", "unpublished"] },
      "published_at": { "type": ["string", "null"], "format": "date-time" }, "updated_at": { "type": ["string", "null"], "format": "date-time" },
      "canonical_url": { "type": "string", "format": "uri", "description": "Always on the client's domain, from its url_template" },
      "category": { "$ref": "#/$defs/category" }, "tags": { "type": "array", "items": { "type": "string" } },
      "author": { "$ref": "#/$defs/author" }, "language": { "type": "string", "examples": ["en"] },
      "site_state": { "enum": ["pending", "live", "rejected", "draft"], "description": "What the site last reported via POST …/status" } } },
    "block": { "type": "object", "required": ["type"], "properties": {
      "type": { "enum": ["heading", "paragraph", "list", "image", "quote", "callout", "table", "code"] },
      "level": { "enum": [2, 3] }, "text": { "type": "string" }, "md": { "type": "string" }, "anchor": { "type": "string" },
      "links": { "type": "array", "items": { "$ref": "#/$defs/link" } },
      "ordered": { "type": "boolean" },
      "items": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string" }, "md": { "type": "string" }, "links": { "type": "array", "items": { "$ref": "#/$defs/link" } } } } },
      "tone": { "enum": ["note", "tip", "warning", "important", "caution", "risk"] },
      "header": { "type": "array", "items": { "type": "string" } }, "rows": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } },
      "language": { "type": ["string", "null"] } } },
    "article": { "allOf": [{ "$ref": "#/$defs/summary" }, { "type": "object", "required": ["blocks", "html"], "properties": {
      "keyword": { "type": ["string", "null"] }, "cover": { "oneOf": [{ "$ref": "#/$defs/image" }, { "type": "null" }] },
      "images": { "type": "array", "items": { "$ref": "#/$defs/image" } }, "blocks": { "type": "array", "items": { "$ref": "#/$defs/block" } },
      "faq": { "type": "array", "items": { "type": "object", "properties": { "q": { "type": "string" }, "a": { "type": "string" } } } },
      "html": { "type": "string", "description": "Generated from blocks; sanitize it anyway" },
      "warnings": { "type": "array", "items": { "type": "string" } } } }] },
    "tombstone": { "type": "object", "required": ["id", "status"], "properties": {
      "id": { "type": "string", "format": "uuid" }, "slug": { "type": ["string", "null"] }, "status": { "enum": ["deleted", "unpublished"] },
      "at": { "type": "string", "format": "date-time" } } }
  },
  "oneOf": [
    { "title": "List", "type": "object", "required": ["articles", "tombstones", "has_more"], "properties": {
      "site": { "type": "string" }, "articles": { "type": "array", "items": { "$ref": "#/$defs/summary" } },
      "tombstones": { "type": "array", "items": { "$ref": "#/$defs/tombstone" } },
      "next_cursor": { "type": ["string", "null"], "description": "Opaque; pass back as ?cursor=" },
      "next_updated_since": { "type": ["string", "null"] }, "has_more": { "type": "boolean" } } },
    { "title": "Article", "$ref": "#/$defs/article" },
    { "title": "Gone (410)", "type": "object", "required": ["tombstone"], "properties": { "tombstone": { "$ref": "#/$defs/tombstone" } } },
    { "title": "Webhook body", "type": "object", "required": ["event", "event_id", "created_at"], "properties": {
      "event": { "enum": ["article.published", "article.updated", "article.unpublished", "article.deleted", "article.test"] },
      "event_id": { "type": "string" }, "created_at": { "type": "integer", "description": "Unix seconds, same as X-Aerius-Timestamp" },
      "article_v2": { "$ref": "#/$defs/article" }, "tombstone": { "$ref": "#/$defs/tombstone" } } }
  ]
}
