{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/edgechat-ai/json-schema/edgechat-ai-get-articles-response-schema.json",
  "title": "GetArticlesResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/edgechat-ai-articles-api-openapi.yml#/components/schemas/GetArticlesResponse",
  "oneOf": [
    {
      "$ref": "#/$defs/ArticleAnswer"
    },
    {
      "$ref": "#/$defs/ArticleBatch"
    },
    {
      "$ref": "#/$defs/Walk"
    }
  ],
  "$defs": {
    "Article": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "moved_from": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "updated": {
          "type": "string",
          "format": "date"
        },
        "topic_path": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Topic"
          },
          "description": "The article's topics, from its top-level branch down to its own topic."
        },
        "geo": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/Topic"
              },
              {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "array",
                    "items": {
                      "$ref": "#/$defs/Topic"
                    }
                  }
                }
              }
            ]
          },
          "description": "Where the article sits on the geography tree (see /geo), each node with its path from the region down; empty when it is not placed."
        },
        "excerpt": {
          "type": "string",
          "description": "The corpus snippet when available, otherwise the article opening as plain text."
        },
        "markdown": {
          "type": "string",
          "description": "The article as Markdown with its citations. Absent when an option answers instead (q=, chunks=1, format=tables); replaced by the part asked for (section=, length=, max_tokens=)."
        },
        "same_as": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "markdown_url": {
          "type": "string",
          "format": "uri"
        },
        "license": {
          "$ref": "#/$defs/License"
        },
        "credit": {
          "type": "string",
          "description": "Show this line, with its link, wherever you show the text."
        },
        "snippet": {
          "type": "string",
          "description": "Optional corpus-authored summary, separate from the article opening. Present on corpus-v1.5 articles and their preview results."
        },
        "node": {
          "type": "string",
          "description": "Current concept-tree node of the article, when available. May change when the corpus tree is revised."
        },
        "credit_md": {
          "type": "string"
        },
        "credit_html": {
          "type": "string"
        },
        "speakable": {
          "type": "string"
        },
        "importance": {
          "type": "number",
          "description": "Only when fields= names it (fields=title,importance): an article fetch looks nothing up that it was not asked for."
        },
        "rank": {
          "type": "integer",
          "description": "Only when fields= names it (fields=title,importance): an article fetch looks nothing up that it was not asked for."
        },
        "words": {
          "type": "integer",
          "description": "Only when fields= names it (fields=title,importance): an article fetch looks nothing up that it was not asked for."
        },
        "reading_grade": {
          "type": "integer",
          "description": "Only when fields= names it (fields=title,importance): an article fetch looks nothing up that it was not asked for."
        },
        "reading_minutes": {
          "type": "integer",
          "description": "Only when fields= names it (fields=title,importance): an article fetch looks nothing up that it was not asked for."
        }
      },
      "required": [
        "id",
        "slug",
        "title",
        "updated",
        "topic_path",
        "same_as",
        "url",
        "markdown_url",
        "license",
        "credit"
      ]
    },
    "ArticleAnswer": {
      "description": "An article, with the fields of the options asked for.",
      "allOf": [
        {
          "$ref": "#/$defs/Article"
        },
        {
          "$ref": "#/$defs/ArticleOptions"
        }
      ]
    },
    "ArticleBatch": {
      "type": "object",
      "description": "?ids=: each article named, in order, or an error for one that an option refused; the ones that answered nothing in `missing`.",
      "properties": {
        "articles": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "asked": {
                    "type": "string"
                  },
                  "error": {
                    "$ref": "#/$defs/Error"
                  }
                }
              },
              {
                "$ref": "#/$defs/ArticleAnswer"
              }
            ]
          }
        },
        "missing": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "license": {
          "$ref": "#/$defs/License"
        }
      }
    },
    "ArticleOptions": {
      "type": "object",
      "description": "Fields an article answer carries while the options are on (WP3, 2026-10-07).",
      "properties": {
        "credit_md": {
          "type": "string"
        },
        "credit_html": {
          "type": "string"
        },
        "speakable": {
          "type": "string"
        },
        "license": {
          "type": "object",
          "properties": {
            "spdx": {
              "type": "string"
            }
          }
        },
        "next": {
          "type": "array",
          "maxItems": 5,
          "items": {
            "$ref": "#/$defs/ArticleRef"
          }
        },
        "resolved_from": {
          "type": "string"
        },
        "resolved_by": {
          "type": "string",
          "enum": [
            "address",
            "title",
            "search"
          ]
        },
        "nearest": {
          "type": "array",
          "maxItems": 3,
          "items": {
            "$ref": "#/$defs/ArticleRef"
          }
        },
        "section": {
          "type": "string"
        },
        "outline": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "level": {
                "type": "integer"
              },
              "heading": {
                "type": "string"
              },
              "parent": {
                "type": "string"
              },
              "tokens": {
                "type": "integer"
              }
            }
          }
        },
        "tokens_estimate": {
          "type": "integer"
        },
        "truncated": {
          "type": "boolean"
        },
        "next_cursor": {
          "type": "string"
        },
        "chunks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Chunk"
          }
        },
        "passages": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/Chunk"
              },
              {
                "type": "object",
                "properties": {
                  "score": {
                    "type": "number"
                  }
                }
              }
            ]
          }
        },
        "tables": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "section": {
                "type": "string"
              },
              "columns": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "rows": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "cites": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  }
                }
              },
              "sources": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "csv": {
                "type": "string"
              }
            }
          }
        },
        "cite_url": {
          "type": "string"
        },
        "quote_found": {
          "type": "boolean"
        },
        "cite": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "object"
            }
          ]
        },
        "links_in": {
          "type": "object",
          "description": "links=in or both: the first 30 articles linking here.",
          "properties": {
            "total": {
              "type": "integer"
            },
            "more": {
              "type": "string"
            },
            "results": {
              "type": "array",
              "items": {
                "type": "object"
              }
            }
          }
        },
        "links_out": {
          "type": "array",
          "description": "links=out or both: the links the article makes.",
          "items": {
            "type": "object"
          }
        },
        "importance": {
          "type": "number",
          "description": "Only when fields= names it."
        },
        "rank": {
          "type": "integer",
          "description": "Only when fields= names it."
        },
        "words": {
          "type": "integer",
          "description": "Only when fields= names it."
        },
        "reading_grade": {
          "type": "number",
          "description": "Only when fields= names it."
        },
        "reading_minutes": {
          "type": "integer",
          "description": "Only when fields= names it."
        }
      }
    },
    "ArticleRef": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "api_url": {
          "type": "string"
        },
        "importance": {
          "type": "number"
        },
        "rank": {
          "type": "integer"
        }
      }
    },
    "Chunk": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "path": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "text": {
          "type": "string"
        },
        "cite_url": {
          "type": "string"
        }
      }
    },
    "Error": {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "hint": {
              "type": "string"
            },
            "next": {
              "type": "string",
              "format": "uri"
            },
            "did_you_mean": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "api_url": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "required": [
            "code",
            "message"
          ]
        }
      },
      "required": [
        "error"
      ]
    },
    "License": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "summary": {
          "type": "string"
        },
        "spdx": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "url"
      ]
    },
    "Topic": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "articles": {
          "type": "integer"
        },
        "api_url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "id",
        "label",
        "api_url"
      ]
    },
    "Walk": {
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "api_url": {
                "type": "string"
              }
            }
          }
        },
        "next": {
          "type": [
            "string",
            "null"
          ]
        },
        "after": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}