openapi: 3.1.0
info:
  title: shaft 公開 API
  version: 1.0.0
  summary: ゴルフシャフトのカタログ、相場、出品を返す読み取り専用の API
  description: |
    shaft のカタログ(ブランド、シリーズ、スペック)、相場、出品を返す。

    - メソッドは GET と HEAD だけ。ほかのメソッドは 405(`Allow: GET, HEAD`)。
    - キー名は snake_case。日付は YYYY-MM-DD(JST の集計基準日)、時刻は ISO 8601 の UTC。
    - クエリの値が不正なら 400。空の値(`?q=`)は未指定と同じ。知らないパラメータは無視する。
    - `/api/v1/` の下の存在しないパスは 404。
    - API キーは任意。キーが無くても読める。キーを付けるとレート制限が IP ごと毎分 60 回からキーごと毎分 600 回に上がる。
    - 匿名の 200 はエッジに 5 分キャッシュする。同じ URL の匿名の応答がキャッシュにあると、キー付きでもキーを検証せずにそれを返す。
      キー付きで呼ぶときはリクエストに `Cache-Control: no-cache` を付ける。
    - すべての応答に `X-Content-Type-Options: nosniff` が付く。
    - CORS には対応していない(サーバー間の呼び出しを想定)。
servers:
  - url: /api/v1
    description: この仕様を配信しているサイト
security:
  - {}
  - apiKey: []
tags:
  - name: shafts
    description: スペック(シリーズ × 重量帯 × フレックス)
  - name: brands
    description: ブランドとシリーズ
paths:
  /shafts:
    get:
      tags: [shafts]
      operationId: searchShafts
      summary: スペックを検索する
      description: |
        検索語の正規化と一致の判定は公開サイトの /search と同じ。検索語も絞り込みも無ければ全スペックを返す。
        並び順は、検索語があればシリーズの一致の点数が高い順、無ければブランドの slug、発売年の新しい順(不明は末尾)、シリーズ名の順。
        シリーズの中は重量帯、フレックスの柔らかい順。
      parameters:
        - name: q
          in: query
          description: 検索語。前後の空白を取り除き、NFKC、小文字、ひらがなからカタカナの順に正規化して最大 6 トークンに分ける
          schema:
            type: string
            maxLength: 100
        - name: category
          in: query
          description: シリーズの用途で絞る
          schema:
            $ref: '#/components/schemas/Category'
        - name: flex
          in: query
          description: スペックのフレックスで絞る。大文字だけ
          schema:
            $ref: '#/components/schemas/Flex'
        - name: weight_class
          in: query
          description: スペックの重量帯で絞る
          schema:
            type: string
            pattern: '^[0-9]{1,3}$'
        - $ref: '#/components/parameters/SearchLimit'
        - name: offset
          in: query
          description: 先頭から飛ばす件数
          schema:
            type: integer
            minimum: 0
            maximum: 10000
            default: 0
      responses:
        '200':
          description: 条件に合うスペック
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            X-Cache:
              $ref: '#/components/headers/XCache'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShaftSearchResponse'
        '400':
          $ref: '#/components/responses/InvalidParameter'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
  /shafts/{slug}:
    get:
      tags: [shafts]
      operationId: getShaft
      summary: スペックの詳細を返す
      parameters:
        - $ref: '#/components/parameters/SkuSlug'
      responses:
        '200':
          description: スペックの詳細と同じシリーズの全スペック
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            X-Cache:
              $ref: '#/components/headers/XCache'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShaftDetail'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
  /shafts/{slug}/stats:
    get:
      tags: [shafts]
      operationId: getShaftStats
      summary: スペックの相場を返す
      description: |
        期間 × 状態 × スリーブ有無の組み合わせごとに 1 件。指定しなかった軸はすべての値を返す。
        並び順は期間(30d、90d、365d)、状態(used、new)、スリーブ(false、true)。値が無い組み合わせは stat が null。
        スペックの n が 5 未満なら、シリーズ全体の値を参考値(scope: series、reference: true)として返す。
      parameters:
        - $ref: '#/components/parameters/SkuSlug'
        - name: window
          in: query
          description: 集計の期間。省略するとすべて
          schema:
            $ref: '#/components/schemas/Window'
        - name: condition
          in: query
          description: 中古か新品か。省略するとすべて
          schema:
            $ref: '#/components/schemas/StatCondition'
        - name: sleeve
          in: query
          description: スリーブ付きの成約か。true と false だけ受け付ける。省略するとすべて
          schema:
            type: boolean
      responses:
        '200':
          description: スペックの相場
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            X-Cache:
              $ref: '#/components/headers/XCache'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShaftStatsResponse'
        '400':
          $ref: '#/components/responses/InvalidParameter'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
  /shafts/{slug}/history:
    get:
      tags: [shafts]
      operationId: getShaftHistory
      summary: スペックの相場の推移を返す
      description: |
        集計の基準日(as_of)ごとの値を古い順に返す。スペック単体の値だけで、シリーズ全体の値には切り替えない。
        week は月曜始まりの週ごとに、その週で最後の基準日の点だけを残す。
      parameters:
        - $ref: '#/components/parameters/SkuSlug'
        - name: granularity
          in: query
          description: 点の間隔
          schema:
            $ref: '#/components/schemas/HistoryGranularity'
            default: day
        - name: window
          in: query
          description: 集計の期間
          schema:
            $ref: '#/components/schemas/Window'
            default: 90d
        - name: condition
          in: query
          description: 中古か新品か
          schema:
            $ref: '#/components/schemas/StatCondition'
            default: used
        - name: sleeve
          in: query
          description: スリーブ付きの成約か。true と false だけ受け付ける
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: 相場の推移
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            X-Cache:
              $ref: '#/components/headers/XCache'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShaftHistoryResponse'
        '400':
          $ref: '#/components/responses/InvalidParameter'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
  /shafts/{slug}/listings:
    get:
      tags: [shafts]
      operationId: listShaftListings
      summary: スペックの出品を返す
      description: |
        相場の集計と同じ条件(同定の信頼度 0.9 以上、新品か中古、ヘッド付きでない、1 本だけ)の出品。外れ値は除かない。
        active は出品中を価格の安い順、sold は成約を新しい順(成約の時刻、無ければ最後に見た時刻)。
        タイトル原文と出品者に関わる値は返さない。ページングは無い。
        Yahoo!ショッピング(yahoo-shopping)の出品は返さない(出典の規約の確認中)。
      parameters:
        - $ref: '#/components/parameters/SkuSlug'
        - name: status
          in: query
          description: active は出品中、sold は成約
          schema:
            $ref: '#/components/schemas/ApiListingStatus'
            default: active
        - name: limit
          in: query
          description: 返す件数
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
      responses:
        '200':
          description: スペックの出品
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            X-Cache:
              $ref: '#/components/headers/XCache'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShaftListingsResponse'
        '400':
          $ref: '#/components/responses/InvalidParameter'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
  /brands:
    get:
      tags: [brands]
      operationId: listBrands
      summary: ブランドの一覧を返す
      description: ブランドの slug の順。
      responses:
        '200':
          description: ブランドの一覧
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            X-Cache:
              $ref: '#/components/headers/XCache'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BrandListResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
  /brands/{slug}/series:
    get:
      tags: [brands]
      operationId: listBrandSeries
      summary: ブランドのシリーズとスペックを返す
      description: シリーズは発売年の新しい順(不明は末尾)、同じ年はシリーズ名の順。
      parameters:
        - $ref: '#/components/parameters/BrandSlug'
      responses:
        '200':
          description: ブランドのシリーズ
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            X-Cache:
              $ref: '#/components/headers/XCache'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BrandSeriesResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: shaft_ で始まる API キー
      description: |
        `Authorization: Bearer <キー>`。キーは shaft の運用者が発行する。キーが無効、失効、期限切れなら 401(匿名の扱いには切り替えない)。
  parameters:
    SkuSlug:
      name: slug
      in: path
      required: true
      description: スペックの slug(`{ブランド}-{シリーズ}-{重量帯}-{フレックス}` の小文字)。形が合わなければ 404
      schema:
        type: string
        pattern: '^[a-z0-9]+(?:-[a-z0-9]+)*$'
      example: fujikura-ventus-blue-6-s
    BrandSlug:
      name: slug
      in: path
      required: true
      description: ブランドの slug。形が合わなければ 404
      schema:
        type: string
        pattern: '^[a-z0-9]+(?:-[a-z0-9]+)*$'
      example: fujikura
    SearchLimit:
      name: limit
      in: query
      description: 返す件数
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
  headers:
    CacheControl:
      description: |
        匿名の 200 は `public, s-maxage=300`(エッジに 5 分)、キー付きの 200 は `private, no-store`。
        キャッシュに当たった応答(X-Cache: HIT)は、キー付きのリクエストでも `public, s-maxage=300`。
      schema:
        type: string
        enum: ['public, s-maxage=300', 'private, no-store']
    CacheControlPrivate:
      description: エラーはキャッシュしない
      schema:
        type: string
        const: private, no-store
    XCache:
      description: HIT はキャッシュから返した、MISS は今回キャッシュに入れた、BYPASS はキャッシュの対象外
      schema:
        type: string
        enum: [HIT, MISS, BYPASS]
    RateLimitLimit:
      description: 窓(60 秒)あたりの上限。キー付きの応答と、回数を数えた後のエラーに付く。匿名の 200 には付かない
      schema:
        type: integer
    RateLimitRemaining:
      description: この窓の残りの回数。付く条件は RateLimit-Limit と同じ
      schema:
        type: integer
    RateLimitReset:
      description: 窓が切り替わるまでの秒数。付く条件は RateLimit-Limit と同じ
      schema:
        type: integer
    RetryAfter:
      description: 次の窓までの秒数(RateLimit-Reset と同じ値)
      schema:
        type: integer
    WWWAuthenticate:
      description: '`Bearer realm="shaft", error="invalid_token"`'
      schema:
        type: string
  responses:
    InvalidParameter:
      description: クエリの値が不正
      headers:
        Cache-Control:
          $ref: '#/components/headers/CacheControlPrivate'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: urn:shaft:problem:invalid-parameter
            title: パラメータが不正です
            status: 400
            detail: クエリパラメータが不正です
            instance: /api/v1/shafts?limit=0
            invalid_params:
              - name: limit
                reason: '小さすぎる値: numberは1以上である必要があります'
    Unauthorized:
      description: Authorization の形が不正、またはキーが無効、失効、期限切れ。回数は数えない
      headers:
        Cache-Control:
          $ref: '#/components/headers/CacheControlPrivate'
        WWW-Authenticate:
          $ref: '#/components/headers/WWWAuthenticate'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    NotFound:
      description: slug のスペックやブランドが無い、または slug の形が不正
      headers:
        Cache-Control:
          $ref: '#/components/headers/CacheControlPrivate'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: urn:shaft:problem:not-found
            title: 見つかりません
            status: 404
            detail: シャフト「fujikura-ventus-blue-9-s」は見つかりません
            instance: /api/v1/shafts/fujikura-ventus-blue-9-s
    RateLimited:
      description: |
        レート制限の上限を超えた(匿名は IP ごと 60 回 / 60 秒、キーは キーごと 600 回 / 60 秒。固定窓)。
        Cloudflare のレート制限ルールが返す 429 は本文が問題詳細の形にならない。
      headers:
        Cache-Control:
          $ref: '#/components/headers/CacheControlPrivate'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Internal:
      description: 想定外のエラー。detail に内部の情報は出さない
      headers:
        Cache-Control:
          $ref: '#/components/headers/CacheControlPrivate'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  schemas:
    Flex:
      description: フレックス。柔らかい順
      type: string
      enum: [L, A, R2, R1, R, SR, S, SX, X, TX]
    Category:
      description: 用途
      type: string
      enum: [wood, hybrid, iron, putter]
    Material:
      description: 素材
      type: string
      enum: [graphite, steel]
    StatCondition:
      description: 状態。used は中古、new は新品
      type: string
      enum: [new, used]
    Window:
      description: 集計の期間
      type: string
      enum: [30d, 90d, 365d]
    HistoryGranularity:
      description: 推移の点の間隔
      type: string
      enum: [day, week]
    ApiListingStatus:
      description: active は出品中、sold は成約
      type: string
      enum: [active, sold]
    BrandRef:
      type: object
      required: [slug, name_ja, name_en]
      properties:
        slug:
          type: string
          examples: [fujikura]
        name_ja:
          type: string
          examples: [フジクラ]
        name_en:
          type: string
          examples: [Fujikura]
    SeriesRef:
      type: object
      required: [slug, name, category, material, release_year]
      properties:
        slug:
          type: string
          examples: [ventus-blue]
        name:
          type: string
          examples: [VENTUS Blue]
        category:
          $ref: '#/components/schemas/Category'
        material:
          $ref: '#/components/schemas/Material'
        release_year:
          description: 発売年。不明は null
          type: [integer, 'null']
    ShaftSummary:
      description: スペック(シリーズ × 重量帯 × フレックス)の要約
      type: object
      required: [slug, brand, series, weight_class, flex, url]
      properties:
        slug:
          description: スペックの slug。/shafts/{slug} の slug
          type: string
          examples: [fujikura-ventus-blue-6-s]
        brand:
          $ref: '#/components/schemas/BrandRef'
        series:
          $ref: '#/components/schemas/SeriesRef'
        weight_class:
          description: 重量帯(メーカーの表記)
          type: string
          examples: ['6']
        flex:
          $ref: '#/components/schemas/Flex'
        url:
          description: shaft のスペックページ
          type: string
          format: uri
    ShaftSearchResponse:
      type: object
      required: [tokens, total, limit, offset, items]
      properties:
        tokens:
          description: 正規化後の検索トークン。q が無ければ空
          type: array
          items:
            type: string
        total:
          description: 条件に合うスペックの総数(limit と offset で切る前)
          type: integer
        limit:
          type: integer
        offset:
          type: integer
        items:
          type: array
          items:
            $ref: '#/components/schemas/ShaftSummary'
    ShaftSpec:
      description: カタログの仕様。分からない値は null
      type: object
      required:
        [weight_g, torque, kick_point, tip_diameter_in, length_in, msrp_jpy, is_oem_stock, discontinued]
      properties:
        weight_g:
          type: [number, 'null']
        torque:
          type: [number, 'null']
        kick_point:
          description: 先、先中、中、中元、元のいずれか(DB に制約は無い)
          type: [string, 'null']
        tip_diameter_in:
          type: [number, 'null']
        length_in:
          type: [number, 'null']
        msrp_jpy:
          description: 定価
          type: [integer, 'null']
        is_oem_stock:
          description: 純正(OEM)シャフトか
          type: boolean
        discontinued:
          description: 廃番か
          type: boolean
    ShaftVariant:
      description: 同じシリーズのスペック。重量帯、フレックスの柔らかい順
      type: object
      required: [slug, weight_class, flex, current]
      properties:
        slug:
          description: スペックの slug
          type: string
        weight_class:
          type: string
        flex:
          $ref: '#/components/schemas/Flex'
        current:
          description: 応答のスペック自身か
          type: boolean
    ShaftDetail:
      allOf:
        - $ref: '#/components/schemas/ShaftSummary'
        - type: object
          required: [spec, variants]
          properties:
            spec:
              $ref: '#/components/schemas/ShaftSpec'
            variants:
              description: 同じシリーズの全スペック(自身を含む)
              type: array
              items:
                $ref: '#/components/schemas/ShaftVariant'
    StatValue:
      description: |
        相場の 1 値。スペックの n >= 5 なら scope = sku、reference = false。
        不足時はシリーズ全体(全重量帯と全フレックス)の値を scope = series、reference = true で返す(シリーズ全体の n も 5 未満のことがある)。
        シリーズ全体も無ければスペックの n < 5 の値を scope = sku、reference = true で返す。
      type: object
      required: [scope, reference, n, median_jpy, p25_jpy, p75_jpy, trend_pct, as_of]
      properties:
        scope:
          type: string
          enum: [sku, series]
        reference:
          description: 参考値か。true の値は確定値として扱わない
          type: boolean
        n:
          description: 成約の件数(外れ値を除いた後)
          type: integer
        median_jpy:
          type: integer
        p25_jpy:
          type: integer
        p75_jpy:
          type: integer
        trend_pct:
          description: 直近 30 日の中央値 ÷ その前の 30 日の中央値 − 1 の百分率(小数 1 桁)。scope = series では null
          type: [number, 'null']
        as_of:
          description: 集計の基準日
          type: string
          format: date
    ShaftStatEntry:
      type: object
      required: [window, condition, sleeve, stat]
      properties:
        window:
          $ref: '#/components/schemas/Window'
        condition:
          $ref: '#/components/schemas/StatCondition'
        sleeve:
          type: boolean
        stat:
          description: 成約が無ければ null
          anyOf:
            - $ref: '#/components/schemas/StatValue'
            - type: 'null'
    ShaftStatsResponse:
      type: object
      required: [slug, as_of, stats]
      properties:
        slug:
          type: string
        as_of:
          description: 相場の基準日(このスペックの集計の最新日。無ければ今日)
          type: string
          format: date
        stats:
          description: 期間 → 状態(中古 → 新品)→ スリーブ無し → 有りの順
          type: array
          items:
            $ref: '#/components/schemas/ShaftStatEntry'
    HistoryPoint:
      description: 集計の基準日ごとの 1 点
      type: object
      required: [as_of, n, median_jpy, p25_jpy, p75_jpy, reference]
      properties:
        as_of:
          type: string
          format: date
        n:
          type: integer
        median_jpy:
          type: integer
        p25_jpy:
          type: integer
        p75_jpy:
          type: integer
        reference:
          description: n < 5(確定値として扱わない)
          type: boolean
    ShaftHistoryResponse:
      type: object
      required: [slug, granularity, window, condition, sleeve, points]
      properties:
        slug:
          type: string
        granularity:
          $ref: '#/components/schemas/HistoryGranularity'
        window:
          $ref: '#/components/schemas/Window'
        condition:
          $ref: '#/components/schemas/StatCondition'
        sleeve:
          type: boolean
        points:
          description: as_of の古い順
          type: array
          items:
            $ref: '#/components/schemas/HistoryPoint'
    Listing:
      description: 出品 1 件。出品者の情報とタイトル原文は返さない
      type: object
      required:
        [source, url, price_jpy, shipping_included, condition, sleeve, first_seen_at, last_seen_at, ended_at]
      properties:
        source:
          description: 出品元の slug
          type: string
          examples: [rakuten-ichiba]
        url:
          description: 出品元のページ。表示するときは出典としてこのリンクを付ける
          type: string
          format: uri
        price_jpy:
          description: 出品元に出ていた価格
          type: integer
        shipping_included:
          description: price_jpy が送料込みか
          type: boolean
        condition:
          $ref: '#/components/schemas/StatCondition'
        sleeve:
          description: スリーブ付きか
          type: boolean
        first_seen_at:
          description: shaft が最初にその出品を見た時刻
          type: string
          format: date-time
        last_seen_at:
          description: shaft が最後にその出品を見た時刻
          type: string
          format: date-time
        ended_at:
          description: 成約や終了の時刻。出品中は null
          type: [string, 'null']
          format: date-time
    ShaftListingsResponse:
      type: object
      required: [slug, status, items]
      properties:
        slug:
          type: string
        status:
          $ref: '#/components/schemas/ApiListingStatus'
        items:
          description: active は価格の安い順、sold は成約の新しい順
          type: array
          items:
            $ref: '#/components/schemas/Listing'
    Brand:
      allOf:
        - $ref: '#/components/schemas/BrandRef'
        - type: object
          required: [series_count, sku_count, url]
          properties:
            series_count:
              type: integer
            sku_count:
              type: integer
            url:
              description: shaft のブランドページ
              type: string
              format: uri
    BrandListResponse:
      type: object
      required: [items]
      properties:
        items:
          description: ブランドの slug の順
          type: array
          items:
            $ref: '#/components/schemas/Brand'
    SeriesVariant:
      description: シリーズのスペック。重量帯、フレックスの柔らかい順。詳細は /shafts/{slug}
      type: object
      required: [slug, weight_class, flex]
      properties:
        slug:
          description: スペックの slug
          type: string
        weight_class:
          type: string
        flex:
          $ref: '#/components/schemas/Flex'
    Series:
      allOf:
        - $ref: '#/components/schemas/SeriesRef'
        - type: object
          required: [aliases, url, variants]
          properties:
            aliases:
              description: シリーズの別名
              type: array
              items:
                type: string
            url:
              description: shaft のシリーズページ
              type: string
              format: uri
            variants:
              type: array
              items:
                $ref: '#/components/schemas/SeriesVariant'
    BrandSeriesResponse:
      type: object
      required: [brand, items]
      properties:
        brand:
          $ref: '#/components/schemas/BrandRef'
        items:
          description: 発売年の新しい順(不明は末尾)、同じ年はシリーズ名の順
          type: array
          items:
            $ref: '#/components/schemas/Series'
    InvalidParam:
      type: object
      required: [name, reason]
      properties:
        name:
          description: クエリパラメータ名
          type: string
        reason:
          description: 不正な理由(zod の日本語の文言)
          type: string
    Problem:
      description: RFC 9457 の問題詳細。分岐には type を使う
      type: object
      required: [type, title, status, detail]
      properties:
        type:
          description: |
            問題の種類を表す URN。開ける URL ではない。今ある値は urn:shaft:problem: に続けて
            invalid-parameter(400)、unauthorized(401)、not-found(404)、method-not-allowed(405)、
            rate-limited(429)、internal(500)。種類は増えることがある
          type: string
        title:
          description: 種類ごとに決まった短い説明
          type: string
        status:
          type: integer
        detail:
          description: このリクエストに固有の説明
          type: string
        instance:
          description: リクエストのパスとクエリ
          type: string
        invalid_params:
          description: 400 のときだけ
          type: array
          items:
            $ref: '#/components/schemas/InvalidParam'
