{
  "openapi": "3.1.0",
  "info": {
    "title": "Manabi Map 学校基本情報 API",
    "version": "0.7.0",
    "summary": "出典を追跡できる日本の高等学校・高等専門学校の基本情報。",
    "description": "収録方針: 一次資料 100%・出典明示 100%・商用サイトからの転載ゼロ\n\n認証は不要で、CORS は全 origin に開いています。実体は固定 URL の静的 JSON なので、\n検索・絞り込みのパラメータはありません。全件または都道府県別に取得して、\n利用側で絞り込んでください。\n\n再配布・改変には出典表記が必要です（CC BY-SA 4.0）。表記例: 出典: Manabi Map（まなびマップ） https://manabi-map.app （CC BY-SA 4.0）\n\n偏差値の編集推計と、出典 URL を確認できない項目は、この API には含めません。\n学校を序列化する用途（順位づけ・合否可能性の判定）には使えません。",
    "license": {
      "name": "CC BY-SA 4.0",
      "url": "https://creativecommons.org/licenses/by-sa/4.0/"
    },
    "contact": {
      "name": "Manabi Map",
      "url": "https://manabi-map.app/data/",
      "email": "hello@manabi-map.app"
    }
  },
  "externalDocs": {
    "description": "フィールド定義（全項目の型と収録条件）",
    "url": "https://github.com/ishizakahiroshi/manabi-map/blob/main/DATA.md"
  },
  "servers": [
    {
      "url": "https://manabi-map.app"
    }
  ],
  "paths": {
    "/api/v1/dataset.json": {
      "get": {
        "operationId": "getDataset",
        "summary": "データセットの収録範囲・ライセンス・配布先を取得する",
        "description": "収録件数と都道府県別の内訳。最初にこれを読むと、どの県が使えるか分かります。",
        "responses": {
          "200": {
            "description": "データセットのメタデータ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatasetMetadata"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schools.json": {
      "get": {
        "operationId": "listAllSchools",
        "summary": "収録校を全件取得する",
        "description": "全都道府県ぶんを 1 ファイルで返します。県が決まっているなら県別の方が軽量です。",
        "responses": {
          "200": {
            "description": "収録校の全件",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SchoolCollection"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schools/{prefecture}.json": {
      "get": {
        "operationId": "listSchoolsByPrefecture",
        "summary": "都道府県を指定して収録校を取得する",
        "parameters": [
          {
            "name": "prefecture",
            "in": "path",
            "required": true,
            "description": "都道府県のローマ字 slug（例: gunma）。収録済みの県のみ。",
            "schema": {
              "type": "string",
              "enum": [
                "hokkaido",
                "aomori",
                "iwate",
                "miyagi",
                "akita",
                "yamagata",
                "fukushima",
                "ibaraki",
                "tochigi",
                "gunma",
                "saitama",
                "chiba",
                "tokyo",
                "kanagawa",
                "niigata",
                "toyama",
                "ishikawa",
                "fukui",
                "yamanashi",
                "nagano",
                "gifu",
                "shizuoka",
                "aichi",
                "mie",
                "shiga",
                "kyoto",
                "osaka",
                "hyogo",
                "nara",
                "wakayama",
                "tottori",
                "shimane",
                "okayama",
                "hiroshima",
                "yamaguchi",
                "tokushima",
                "kagawa",
                "ehime",
                "kochi",
                "fukuoka",
                "saga",
                "nagasaki",
                "kumamoto",
                "oita",
                "miyazaki",
                "kagoshima",
                "okinawa"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "指定した都道府県の収録校",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrefectureSchoolCollection"
                }
              }
            }
          },
          "404": {
            "description": "未収録の都道府県"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DatasetMetadata": {
        "type": "object",
        "required": [
          "api_version",
          "generated_at",
          "school_count",
          "prefecture_count",
          "prefectures",
          "license"
        ],
        "properties": {
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "school_count": {
            "type": "integer",
            "minimum": 0
          },
          "prefecture_count": {
            "type": "integer",
            "minimum": 0
          },
          "prefectures": {
            "type": "object",
            "description": "都道府県 slug をキー、収録校数を値とする対応表。",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "license": {
            "type": "string"
          },
          "license_url": {
            "type": "string",
            "format": "uri"
          },
          "attribution": {
            "type": "string",
            "description": "再配布時に添える出典表記。"
          },
          "provenance_policy": {
            "type": "string"
          },
          "inclusion_policy": {
            "type": "string"
          },
          "exclusion_policy": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "SchoolCollection": {
        "type": "object",
        "required": [
          "api_version",
          "generated_at",
          "count",
          "schools"
        ],
        "properties": {
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time",
            "description": "この JSON を生成した時刻。"
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "description": "schools の要素数。"
          },
          "schools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/School"
            }
          }
        },
        "additionalProperties": true
      },
      "PrefectureSchoolCollection": {
        "type": "object",
        "required": [
          "api_version",
          "generated_at",
          "prefecture",
          "count",
          "schools"
        ],
        "properties": {
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time",
            "description": "この JSON を生成した時刻。"
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "description": "schools の要素数。"
          },
          "schools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/School"
            }
          },
          "prefecture": {
            "type": "string",
            "description": "都道府県名（例: 群馬県）。"
          }
        },
        "additionalProperties": true
      },
      "School": {
        "type": "object",
        "description": "どの学校にも必ずある項目だけを定義しています。学科・入試統計・前身校などは出典が確認できた学校にだけ現れるため、全項目の型と収録条件は externalDocs を参照してください。",
        "externalDocs": {
          "description": "全フィールドの定義",
          "url": "https://github.com/ishizakahiroshi/manabi-map/blob/main/DATA.md"
        },
        "required": [
          "id",
          "record_key",
          "name",
          "prefecture",
          "official_url",
          "is_integrated",
          "provenance"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "内部 ID。外部参照には record_key を推奨。"
          },
          "record_key": {
            "type": "string",
            "description": "school-<uuid> 形式の安定キー。"
          },
          "name": {
            "type": "string",
            "description": "学校名（正式名称）。"
          },
          "prefecture": {
            "type": "string",
            "description": "所在の都道府県名。"
          },
          "official_url": {
            "type": "string",
            "format": "uri",
            "description": "学校公式サイト。これを確認できない学校は収録しません。"
          },
          "is_integrated": {
            "type": "boolean",
            "description": "中高一貫かどうか。募集の有無は lifecycle.recruitment_status_code で確認します。"
          },
          "provenance": {
            "type": "object",
            "description": "出典情報。項目単位の出典は field_sources に入ります。",
            "required": [
              "official_url",
              "last_built_at",
              "field_sources"
            ],
            "properties": {
              "official_url": {
                "type": "string",
                "format": "uri"
              },
              "last_built_at": {
                "type": "string",
                "format": "date-time"
              },
              "field_sources": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}
