{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/car-gene-com/json-schema/car-gene-com-factory-response-schema.json",
  "title": "FactoryResponse",
  "description": "工場1つと、そこで作った世代 (発売年の順) とエンジン。子ページ (`/factories/[id]`) の材料\n\n**どちらかは空でない** (両方空の工場は 404)。エンジンだけの工場 (上郷) は `models` が空",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/car-gene-com-factories-api-openapi.yml#/components/schemas/FactoryResponse",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "name": {
      "type": "string",
      "title": "Name"
    },
    "maker_id": {
      "type": "string",
      "title": "Maker Id"
    },
    "maker_name": {
      "type": "string",
      "title": "Maker Name"
    },
    "country_code": {
      "type": "string",
      "title": "Country Code"
    },
    "location": {
      "type": "string",
      "title": "Location"
    },
    "latitude": {
      "type": "number",
      "title": "Latitude"
    },
    "longitude": {
      "type": "number",
      "title": "Longitude"
    },
    "thumbnail_s3key": {
      "type": "string",
      "title": "Thumbnail S3Key"
    },
    "thumbnail_license": {
      "type": "string",
      "title": "Thumbnail License"
    },
    "thumbnail_author": {
      "type": "string",
      "title": "Thumbnail Author"
    },
    "thumbnail_source_url": {
      "type": "string",
      "title": "Thumbnail Source Url"
    },
    "models": {
      "items": {
        "$ref": "#/$defs/FactoryModelResponse"
      },
      "type": "array",
      "title": "Models"
    },
    "engines": {
      "items": {
        "$ref": "#/$defs/EngineListItemResponse"
      },
      "type": "array",
      "title": "Engines"
    }
  },
  "type": "object",
  "required": [
    "id",
    "name",
    "maker_id",
    "maker_name",
    "country_code",
    "location",
    "latitude",
    "longitude",
    "models",
    "engines"
  ],
  "$defs": {
    "EngineListItemResponse": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "code": {
          "type": "string",
          "title": "Code"
        },
        "family": {
          "type": "string",
          "title": "Family"
        },
        "kind": {
          "type": "string",
          "title": "Kind"
        },
        "maker_id": {
          "type": "string",
          "title": "Maker Id"
        },
        "maker_name": {
          "type": "string",
          "title": "Maker Name"
        },
        "project_id": {
          "type": "string",
          "title": "Project Id"
        },
        "thumbnail_s3key": {
          "type": "string",
          "title": "Thumbnail S3Key"
        },
        "thumbnail_license": {
          "type": "string",
          "title": "Thumbnail License"
        },
        "thumbnail_author": {
          "type": "string",
          "title": "Thumbnail Author"
        },
        "thumbnail_source_url": {
          "type": "string",
          "title": "Thumbnail Source Url"
        },
        "layout": {
          "type": "string",
          "title": "Layout"
        },
        "cylinders": {
          "type": "integer",
          "title": "Cylinders"
        },
        "aspiration": {
          "type": "string",
          "title": "Aspiration"
        },
        "displacement_cc_min": {
          "type": "integer",
          "title": "Displacement Cc Min"
        },
        "displacement_cc_max": {
          "type": "integer",
          "title": "Displacement Cc Max"
        },
        "max_power_ps_min": {
          "type": "integer",
          "title": "Max Power Ps Min"
        },
        "max_power_ps_max": {
          "type": "integer",
          "title": "Max Power Ps Max"
        },
        "max_power_kw_min": {
          "type": "number",
          "title": "Max Power Kw Min"
        },
        "max_power_kw_max": {
          "type": "number",
          "title": "Max Power Kw Max"
        },
        "revision_count": {
          "type": "integer",
          "title": "Revision Count",
          "default": 0
        },
        "first_year": {
          "type": "integer",
          "title": "First Year"
        },
        "last_year": {
          "type": "integer",
          "title": "Last Year"
        },
        "models": {
          "items": {
            "$ref": "#/$defs/EngineListModelResponse"
          },
          "type": "array",
          "title": "Models",
          "default": []
        }
      },
      "type": "object",
      "required": [
        "id",
        "code",
        "kind",
        "maker_id",
        "maker_name"
      ],
      "title": "EngineListItemResponse",
      "description": "エンジンの型式1つ。エンジン一覧 (`/engines`) のカードと、`/engines/[id]` を\n書き出す id・sitemap の材料 (#2076)\n\n**版の値は型式の中で畳む。** 形式・気筒は値を持つ版で揃うとき、過給は全部の版で\n同じときだけ値を持ち (揃わなければ null。カードに出さない)、排気量と出力は版の中の\n最小と最大。\n人・説明文・根拠は詳細で返す (一覧は全型式ぶんを配るので重くしない)"
    },
    "EngineListModelResponse": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "series_name": {
          "type": "string",
          "title": "Series Name"
        },
        "start_year": {
          "type": "integer",
          "title": "Start Year"
        },
        "end_year": {
          "type": "integer",
          "title": "End Year"
        }
      },
      "type": "object",
      "required": [
        "id",
        "name",
        "series_name",
        "start_year"
      ],
      "title": "EngineListModelResponse",
      "description": "エンジン一覧のカードの「載った車」。名前と年だけ (画像・根拠は詳細で返す)"
    },
    "FactoryModelResponse": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "series_id": {
          "type": "string",
          "title": "Series Id"
        },
        "series_name": {
          "type": "string",
          "title": "Series Name"
        },
        "maker_name": {
          "type": "string",
          "title": "Maker Name"
        },
        "start_year": {
          "type": "integer",
          "title": "Start Year"
        },
        "end_year": {
          "type": "integer",
          "title": "End Year"
        },
        "thumbnail_s3key": {
          "type": "string",
          "title": "Thumbnail S3Key"
        },
        "thumbnail_license": {
          "type": "string",
          "title": "Thumbnail License"
        },
        "thumbnail_author": {
          "type": "string",
          "title": "Thumbnail Author"
        },
        "thumbnail_source_url": {
          "type": "string",
          "title": "Thumbnail Source Url"
        },
        "period_start_year": {
          "type": "integer",
          "title": "Period Start Year"
        },
        "period_start_month": {
          "type": "integer",
          "title": "Period Start Month"
        },
        "period_end_year": {
          "type": "integer",
          "title": "Period End Year"
        },
        "period_end_month": {
          "type": "integer",
          "title": "Period End Month"
        },
        "scope": {
          "type": "string",
          "title": "Scope"
        },
        "is_primary": {
          "type": "boolean",
          "title": "Is Primary",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "id",
        "name",
        "series_id",
        "series_name",
        "maker_name",
        "start_year"
      ],
      "title": "FactoryModelResponse",
      "description": "この工場で作った世代1つ\n\n期間・範囲・主は世代 × 工場の行のもの (`ModelFactoryResponse` と同じ読み方。\n**空は「出典が言っていない」**)"
    }
  }
}