{
  "openapi": "3.1.0",
  "info": {
    "title": "シルギア 祝日・営業日API",
    "version": "1.0.0",
    "description": "登録不要・無料の日本の祝日API。1955〜2100年の祝日・振替休日・国民の休日を返します。内閣府が公表した年は確定（confirmed: true）、その先は今の祝日法で計算した予定（false）。営業日の計算には /holidays/v1/holidays.js（ES モジュール）も使えます。説明: https://api.shirugear.com/holidays/ 。v1 の中では項目を足すことはあっても、名前や意味は変えません（知らない項目・kind は無視してください）。",
    "termsOfService": "https://api.shirugear.com/terms/",
    "contact": {
      "name": "アナライズギア株式会社（シルギア）",
      "url": "https://shirugear.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.shirugear.com"
    }
  ],
  "paths": {
    "/holidays/v1/{year}.json": {
      "get": {
        "summary": "その年の祝日・休日",
        "operationId": "getHolidaysOfYear",
        "parameters": [
          {
            "name": "year",
            "in": "path",
            "required": true,
            "description": "西暦4桁（1955〜2100）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "example": "2026"
          }
        ],
        "responses": {
          "200": {
            "description": "その年の祝日・休日",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/YearResponse"
                }
              }
            }
          },
          "400": {
            "description": "年の形が違う（invalid_year）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "範囲外の年（year_not_found）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/holidays/v1/all.json": {
      "get": {
        "summary": "全期間の祝日・休日",
        "operationId": "getAllHolidays",
        "responses": {
          "200": {
            "description": "日付 → 名前・種類",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllResponse"
                }
              }
            }
          }
        }
      }
    },
    "/holidays/v1/meta.json": {
      "get": {
        "summary": "データの版・確定している年・件数",
        "operationId": "getHolidaysMeta",
        "responses": {
          "200": {
            "description": "データの版",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetaResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HolidayKind": {
        "type": "string",
        "enum": [
          "national",
          "substitute",
          "citizens",
          "special"
        ],
        "description": "national=国民の祝日 / substitute=振替休日 / citizens=国民の休日 / special=その年だけの休日"
      },
      "Holiday": {
        "type": "object",
        "required": [
          "date",
          "weekday",
          "name",
          "kind",
          "official_name"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "日付（日本の日付）",
            "example": "2026-05-06"
          },
          "weekday": {
            "type": "string",
            "enum": [
              "日",
              "月",
              "火",
              "水",
              "木",
              "金",
              "土"
            ]
          },
          "name": {
            "type": "string",
            "description": "名前。振替休日・国民の休日は見分けた名前",
            "example": "振替休日"
          },
          "kind": {
            "$ref": "#/components/schemas/HolidayKind"
          },
          "official_name": {
            "type": "string",
            "description": "内閣府の一覧での書き方（振替休日・国民の休日は「休日」）",
            "example": "休日"
          }
        }
      },
      "YearResponse": {
        "type": "object",
        "required": [
          "year",
          "confirmed",
          "holidays",
          "confirmed_through",
          "data_version"
        ],
        "properties": {
          "year": {
            "type": "integer",
            "example": 2026
          },
          "confirmed": {
            "type": "boolean",
            "description": "true=内閣府が公表済み / false=今の祝日法で計算した予定"
          },
          "holidays": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Holiday"
            }
          },
          "confirmed_through": {
            "type": "integer",
            "description": "確定している最後の年",
            "example": 2027
          },
          "data_version": {
            "type": "string",
            "format": "date",
            "description": "内閣府の一覧が変わったのを取り込んだ日"
          }
        }
      },
      "AllResponse": {
        "type": "object",
        "required": [
          "from",
          "to",
          "confirmed_through",
          "holidays",
          "data_version"
        ],
        "properties": {
          "from": {
            "type": "integer",
            "example": 1955
          },
          "to": {
            "type": "integer",
            "example": 2100
          },
          "confirmed_through": {
            "type": "integer"
          },
          "holidays": {
            "type": "object",
            "description": "キーは日付 \"YYYY-MM-DD\"",
            "additionalProperties": {
              "type": "object",
              "required": [
                "name",
                "kind"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "kind": {
                  "$ref": "#/components/schemas/HolidayKind"
                }
              }
            }
          },
          "data_version": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "MetaResponse": {
        "type": "object",
        "required": [
          "data_version",
          "built_at",
          "from",
          "to",
          "confirmed_through",
          "sources",
          "counts"
        ],
        "properties": {
          "data_version": {
            "type": "string",
            "format": "date"
          },
          "built_at": {
            "type": "string",
            "format": "date-time",
            "description": "データを作った日時（UTC）"
          },
          "from": {
            "type": "integer"
          },
          "to": {
            "type": "integer"
          },
          "confirmed_through": {
            "type": "integer"
          },
          "sources": {
            "type": "object",
            "properties": {
              "holidays": {
                "type": "string",
                "format": "uri"
              },
              "astronomy": {
                "type": "string"
              }
            }
          },
          "counts": {
            "type": "object",
            "properties": {
              "holidays": {
                "type": "integer",
                "description": "全期間の祝日・休日の数"
              },
              "confirmed": {
                "type": "integer",
                "description": "そのうち確定の数"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "status",
              "code",
              "message"
            ],
            "properties": {
              "status": {
                "type": "integer",
                "enum": [
                  400,
                  404,
                  405
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_year",
                  "year_not_found",
                  "not_found",
                  "method_not_allowed",
                  "invalid_request"
                ]
              },
              "message": {
                "type": "string",
                "description": "説明文（言い回しは変わることがあります）"
              }
            }
          }
        }
      }
    }
  }
}
