{
  "openapi": "3.1.0",
  "info": {
    "title": "Afaai public catalog",
    "version": "1.0.0",
    "description": "Read Afaai articles in English and Traditional Chinese as static JSON files. No key needed. Filter the catalog in your own code; query parameters do not filter files on the server."
  },
  "servers": [
    {
      "url": "https://afaai.tw"
    }
  ],
  "paths": {
    "/api/v1/catalog.json": {
      "get": {
        "operationId": "getCatalog",
        "summary": "Retrieve all published language versions",
        "responses": {
          "200": {
            "description": "Catalog containing schemaVersion, publisher, count, and items",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schemaVersion",
                    "count",
                    "items"
                  ],
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "1.0"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Article"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/workflows/{id}.json": {
      "get": {
        "operationId": "getArticle",
        "summary": "Retrieve one published workflow, guide, or explainer",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "document-to-answers-en"
          }
        ],
        "responses": {
          "200": {
            "description": "A published language-specific record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Article"
                }
              }
            }
          },
          "404": {
            "description": "Unknown identifier; HTML not-found response"
          }
        }
      }
    },
    "/markdown/{id}.md": {
      "get": {
        "operationId": "getArticleMarkdown",
        "summary": "Retrieve the article, steps, prompt, limitations, and sources as Markdown",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published article text",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Unknown identifier"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Article": {
        "type": "object",
        "required": [
          "id",
          "translationKey",
          "language",
          "edition",
          "title",
          "url",
          "updated",
          "reviewAfter",
          "revision",
          "evidence",
          "limitations",
          "sources"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "translationKey": {
            "type": "string"
          },
          "language": {
            "enum": [
              "en",
              "zh-hant"
            ]
          },
          "edition": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "workflow",
              "guide",
              "news"
            ]
          },
          "category": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdownUrl": {
            "type": "string",
            "format": "uri"
          },
          "updated": {
            "type": "string",
            "format": "date"
          },
          "reviewAfter": {
            "type": "string",
            "format": "date"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "evidence": {
            "enum": [
              "source-verified",
              "experimental",
              "tested"
            ]
          },
          "cost": {
            "type": "string"
          },
          "prerequisites": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "title",
                "detail"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                }
              }
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "title",
                "url",
                "checked"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "checked": {
                  "type": "string",
                  "format": "date"
                }
              }
            }
          },
          "prompt": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  }
}
