{
  "openapi": "3.1.1",
  "info": {
    "title": "ChunghwaMC OpenAPI",
    "version": "1.2.0",
    "description": "OpenAPI specification exposing public read endpoints of the ChunghwaMC site. This expanded spec includes commonly used WordPress read endpoints (posts, pages, media, categories, tags, comments) and MediaWiki read endpoints (page, html, source, search). It's intended for discovery and Swagger UI."
  },
  "tags": [
    {
      "name": "wordpress",
      "description": "WordPress REST API"
    },
    {
      "name": "wiki",
      "description": "MediaWiki REST API and Action API"
    }
  ],
  "paths": {
    "/wp-json/wp/v2/pages": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "List pages",
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of page objects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WPPage"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/pages/{id}": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "Get a single page by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WPPage"
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/posts": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "List posts",
        "description": "Returns posts (supports pagination, search, categories, tags filters)",
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categories",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated category IDs"
          },
          {
            "name": "tags",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated tag IDs"
          }
        ],
        "responses": {
          "200": {
            "description": "Array of post objects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WPPost"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/posts/{id}": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "Get a single post by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A post object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WPPost"
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/media": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "List media items",
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "media_type",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by media type (image, video, etc.)"
          }
        ],
        "responses": {
          "200": {
            "description": "Array of media objects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WPMedia"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/media/{id}": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "Get a single media item by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WPMedia"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/wp-json/wp/v2/categories": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "List categories",
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Category"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/categories/{id}": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "Get category by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Category"
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/tags": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "List tags",
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Tag"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/tags/{id}": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "Get tag by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tag"
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/comments": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "List comments",
        "parameters": [
          {
            "name": "post",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Filter comments by post id"
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Comment"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/wp-json/wp/v2/comments/{id}": {
      "get": {
        "tags": [
          "wordpress"
        ],
        "summary": "Get comment by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Comment"
                }
              }
            }
          }
        }
      }
    },
    "/wiki-json/w/v1/page/{title}": {
      "get": {
        "tags": [
          "wiki"
        ],
        "summary": "Get wiki page object (wrapper)",
        "parameters": [
          {
            "name": "title",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "URL-encoded page title"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikiPage"
                }
              }
            }
          }
        }
      }
    },
    "/wiki-json/w/v1/page/{title}/html": {
      "get": {
        "tags": [
          "wiki"
        ],
        "summary": "Get rendered HTML for a wiki page",
        "parameters": [
          {
            "name": "title",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rendered HTML",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/wiki-json/w/v1/page/{title}/source": {
      "get": {
        "tags": [
          "wiki"
        ],
        "summary": "Get wikitext source for a page (if available)",
        "parameters": [
          {
            "name": "title",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/wiki-json/w/v1/search/title": {
      "get": {
        "tags": [
          "wiki"
        ],
        "summary": "Search pages by title (wrapper)",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikiSearchResponse"
                }
              }
            }
          }
        }
      }
    },
    "/wiki/api.php": {
      "get": {
        "tags": ["wiki"],
        "summary": "MediaWiki Action API",
        "description": "useful API!",
        "parameters": [
          { "name": "action", "in": "query", "required": true, "schema": { "type": "string", "enum": ["query", "parse", "opensearch"] } },
          { "name": "format", "in": "query", "schema": { "type": "string", "default": "json" } },
          { "name": "titles", "in": "query", "schema": { "type": "string" }, "description": "Pipe-separated page titles" },
          { "name": "prop", "in": "query", "schema": { "type": "string" }, "description": "Properties to fetch (revisions|info|extracts...)" },
          { "name": "list", "in": "query", "schema": { "type": "string" }, "description": "List module (e.g., search)" },
          { "name": "srsearch", "in": "query", "schema": { "type": "string" }, "description": "Search string for list=search" },
          { "name": "srwhat", "in": "query", "schema": { "type": "string", "enum": ["nearmatch", "text", "title"] }, "description": "Search what for srsearch" },
          { "name": "srlimit", "in": "query", "schema": { "type": "integer", "default": 100 }, "description": "Limit for srsearch results" },
          { "name": "page", "in": "query", "schema": { "type": "string" }, "description": "Page title for action=parse" },
          { "name": "search", "in": "query", "schema": { "type": "string" }, "description": "Search string for opensearch" },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 100 }, "description": "Limit for opensearch results" },
          { "name": "namespace", "in": "query", "schema": { "type": "string", "default": "*" }, "description": "Search namespace for opensearch" }
        ],
        "responses": { "200": { "description": "Action API JSON response", "content": { "application/json": { "schema": { "type": "object" } } } } }
      }
    }
  },
  "components": {
    "schemas": {
      "WPPage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "link": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          },
          "content": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          },
          "excerpt": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          }
        }
      },
      "WPPost": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "title": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          },
          "content": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          },
          "excerpt": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          },
          "link": {
            "type": "string",
            "format": "uri"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "WPMedia": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "slug": {
            "type": "string"
          },
          "media_type": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          }
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          },
          "link": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          },
          "link": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "Comment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "post": {
            "type": "integer"
          },
          "author_name": {
            "type": "string"
          },
          "content": {
            "type": "object",
            "properties": {
              "rendered": {
                "type": "string"
              }
            }
          },
          "date": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WikiPage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "html": {
            "type": "string"
          },
          "revision": {
            "type": "object"
          }
        }
      },
      "WikiSearchResponse": {
        "type": "object",
        "properties": {
          "query": {
            "type": "object",
            "properties": {
              "pages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "title": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": []
}