{
  "openapi": "3.1.0",
  "info": {
    "title": "tlyboy public website API",
    "description": "Read tlyboy’s published project directory and verify the website is responding.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "paths": {
    "/api/projects": {
      "get": {
        "operationId": "listProjects",
        "description": "List public projects with a localized description and the GitHub repository URL.",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "description": "Project description language. Defaults to the site language.",
            "schema": {
              "type": "string",
              "enum": ["en", "zh"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "description": {
                        "type": ["string", "null"],
                        "description": "Localized project description when available, otherwise the source repository description or null."
                      },
                      "language": {
                        "type": ["string", "null"],
                        "description": "Primary language reported by GitHub, or null."
                      }
                    },
                    "required": ["name", "url", "description", "language"],
                    "title": "Project",
                    "additionalProperties": false
                  },
                  "title": "ProjectDirectory"
                },
                "example": [
                  {
                    "name": "headpanel",
                    "url": "https://github.com/tlyboy/headpanel",
                    "description": null,
                    "language": "TypeScript"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "The requested language is unsupported.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "format": "uri-reference"
                    },
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "const": 400
                    },
                    "detail": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "title", "status", "detail"],
                  "title": "ProblemDetails",
                  "additionalProperties": false
                },
                "example": {
                  "type": "about:blank",
                  "title": "Invalid language",
                  "status": 400,
                  "detail": "Use en or zh for the lang parameter."
                }
              }
            }
          },
          "503": {
            "description": "Project directory temporarily unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "format": "uri-reference"
                    },
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "const": 503
                    },
                    "detail": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "title", "status", "detail"],
                  "title": "ProblemDetails",
                  "additionalProperties": false
                },
                "example": {
                  "type": "about:blank",
                  "title": "Project directory unavailable",
                  "status": 503,
                  "detail": "Retry in a few minutes."
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getWebsiteHealth",
        "description": "Check whether the website is responding.",
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": ["ok"],
                  "title": "WebsiteHealth",
                  "additionalProperties": false
                },
                "example": {
                  "ok": true
                }
              }
            }
          }
        }
      }
    }
  }
}
