AliExpress 日本向け SOP
DATA CONTRACT

データ契約・検証

AI が読み書きするデータの形を固定し、公開してよいかどうかをコードで判定します。これは本キットの正規化契約で、AE API の生レスポンスではありません。実データとの対応は AE のデータ接続へ。契約は validator.js が正本で、JSON Schema はそこから書き出しています。

01

エンティティ

1 つの dataset.json に 6 種類のレコード+ meta
エンティティ役割主なキー
evidence根拠(いつ・何を見て確認したか)type source captured_at visibility(public / internal)
offersクーポン・特典discount_type discount_value max_discount min_spend scope eligibility starts_at expires_at status stackable_with stacking_verified
campaignsセール・キャンペーンstarts_at ends_at offer_ids
products商品と価格シナリオaffiliate_status affiliate_verified_at is_hot_product link_policy sku_id page_price stock_status ship_to_jp shipping_fee affiliate_url image.rights freshness_tier scenario market_ref
articles記事(Markdown)と参照先type status(draft / ready)pr_disclosure product_ids offer_ids purchase_record published_at updated_at update_note_ja
channels配信チャネルと計測方法type tracking_method(portal_sub_id / official_tool / s2s / none)tracking_value

記入の決まり

バリデータが付け足す表示用フィールド(display)

公開可データには、画面にそのまま出せる文言が追加されます。AI やテンプレートは価格文言を自作せず、これを使います。

フィールド例
price_label_ja / price_text_ja検証済み割引後の商品価格 / 3,680円
price_breakdown_jaページ価格 3,980円 → ストアクーポン −300円
per_unit_note_ja1点あたり約7,381円(均等按分)
conditional_offers[]15,000円以上の購入で 1,198円引き(それぞれに hide_after)
shipping_label_ja / tax_label_ja送料:要確認
verified_label_ja2026-11-18 09:30 JST 確認
hide_afterこの時刻を過ぎたら画面から自動で隠す(鮮度と、依存する特典の期限のうち早いほう)
02

ルールコード

errorは公開対象から除外、warningは公開可(表示を調整)、infoは参考
共通・根拠・特典・キャンペーンS / G / E / O / C
S00スキーマ違反(型・必須・列挙・null 可否)。構造違反のレコードは業務ルールの検査をスキップ
S01ID の重複
G01サンプルデータを本番モードで使用
E01根拠の取得日時が未来
O01status が expired
O02status が unknown(確認できるまで非公開)
O03status が active でも有効期限を過ぎている
O04開始前、または開始と終了の順序が不正
O05確認から 12 時間以上、または確認日時が未来
O06 O06対象ユーザーが不明(価格に適用不可)/根拠がない
O07〜O09割引の型と値、範囲指定などの条件付き制約
C01 C02キャンペーン終了/確認から 24 時間以上、または確認日時が未来
C03 C03特典が見つからない/公開不可の特典を表示から除外
C04根拠がない
商品と価格P
P01 P02在庫が in_stock でない/日本配送が確認できない
P03確認から時間が経ちすぎ(hot 6 時間/standard 72 時間)
P04根拠がない
P06適用した特典が見つからない・公開不可・対象範囲外
P07利用条件額を満たしていない特典を価格に適用
P08再計算した価格と display_price が 1 円を超えて不一致
P09price_type と適用特典の組み合わせが不正
P10併用の相互指定がない、または併用が未確認
P11画像の利用権限が未確認
P12相場の参考価格が 30 日以上、または確認日時が未来(比較表示を自動で隠す)
P13送料・税の扱いが不明(「要確認」と表示)
P14特典の対象ユーザーが購入条件と一致しない
P15 P15条件付き特典が公開不可で除外/適用済みと条件付きの重複
P17根拠を示せない最上級表現(最安値・No.1 など)
P18許可外 URL・公式原本との不一致・未設定 S2S・未登録 af・未知/重複追記。公式原本のクエリは一律禁止しない。S2S は設定済み af / cn / cv / dp のみ許可
P19指定 SKU の価格・在庫が未確認
P20現在のアフィリエイト資格が対象外・unknown・確認日時欠落/未来/鮮度切れ
記事・チャネルA / CH
A00下書き(公開対象外)
A01PR 表記がない
A02公開不可の商品・特典・キャンペーンを参照
A03実購入レビューに購入記録がない
A04更新日の変更に変更内容(update_note_ja)がない、または日付の順序が不正
A05 A05最上級表現は除外。断定・期限表現(「必ず」「絶対」「今だけ」など)は根拠と期限を要確認
A06有効な特典がないクーポン速報
A07参照先が見つからない
CH01計測方法が none なのに値がある(設定済み公式計測を記録するか null に戻す)
CH02sub ID の形式が不正

依存関係も追跡します。例:特典が unknown(O02)→ それを適用した商品が P06 → その商品を参照する記事が A02 で、すべて公開対象から外れます。

03

ブラウザで検証を試す

データはこのページの中だけで処理され、どこにも送信されません

基準時刻を空にすると現在時刻で判定します。サンプルは 2026-11-18 12:00 JST を想定しています(時間が経つと鮮度切れで除外されるのは正常な動作です)。

04

JSON Schema

2020-12。条件付き制約は if / then と x-rule・x-message-ja で記述

Ajv など一般的な検証器でも使えます(独自キーワードは ajv.addVocabulary(['x-rule','x-message-ja']) で登録)。ただし価格の再計算・期限・鮮度・依存関係などの業務ルールは validator.js でのみ検査されます。

article.schema.jsonJSON Schema 2020-12
schema/article.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "article.schema.json",
  "title": "article",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "type",
    "title_ja",
    "slug",
    "product_ids",
    "offer_ids",
    "campaign_id",
    "pr_disclosure",
    "published_at",
    "updated_at",
    "update_note_ja",
    "purchase_record",
    "body_md",
    "status",
    "is_sample"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
    },
    "type": {
      "enum": [
        "coupon_flash",
        "sale_guide",
        "category_evergreen",
        "honest_review",
        "beginner_guide"
      ]
    },
    "title_ja": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "slug": {
      "type": "string",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
    },
    "product_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      },
      "uniqueItems": true
    },
    "offer_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      },
      "uniqueItems": true
    },
    "campaign_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "pr_disclosure": {
      "type": "boolean"
    },
    "published_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "update_note_ja": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 200,
      "description": "更新日を変える場合の実質的な変更内容"
    },
    "purchase_record": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "required": [
        "purchased_at",
        "evidence_id"
      ],
      "properties": {
        "purchased_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
        },
        "evidence_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
        }
      }
    },
    "body_md": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "enum": [
        "draft",
        "ready"
      ]
    },
    "is_sample": {
      "type": "boolean",
      "description": "サンプルデータは true。production モードでは公開不可"
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "const": "honest_review"
          }
        }
      },
      "then": {
        "properties": {
          "purchase_record": {
            "type": "object"
          }
        }
      },
      "x-rule": "A03",
      "x-message-ja": "実購入レビューには購入記録が必須"
    },
    {
      "if": {
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "const": "coupon_flash"
          }
        }
      },
      "then": {
        "properties": {
          "offer_ids": {
            "type": "array",
            "minItems": 1
          }
        }
      },
      "x-rule": "A06",
      "x-message-ja": "クーポン速報には offer_ids が必須"
    },
    {
      "if": {
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "const": "sale_guide"
          }
        }
      },
      "then": {
        "properties": {
          "campaign_id": {
            "type": "string"
          }
        }
      },
      "x-rule": "A06",
      "x-message-ja": "セール攻略には campaign_id が必須"
    }
  ]
}
campaign.schema.jsonJSON Schema 2020-12
schema/campaign.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "campaign.schema.json",
  "title": "campaign",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "name_ja",
    "starts_at",
    "ends_at",
    "offer_ids",
    "verified_at",
    "evidence_ids",
    "is_sample"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
    },
    "name_ja": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "starts_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "ends_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "offer_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      },
      "uniqueItems": true
    },
    "verified_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "evidence_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      },
      "uniqueItems": true
    },
    "is_sample": {
      "type": "boolean",
      "description": "サンプルデータは true。production モードでは公開不可"
    }
  }
}
channel.schema.jsonJSON Schema 2020-12
schema/channel.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "channel.schema.json",
  "title": "channel",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "type",
    "name",
    "tracking_method",
    "tracking_value",
    "is_sample"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
    },
    "type": {
      "enum": [
        "website",
        "blog",
        "deal_site",
        "x",
        "instagram",
        "threads",
        "line",
        "youtube",
        "tiktok",
        "other"
      ]
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "tracking_method": {
      "enum": [
        "portal_sub_id",
        "official_tool",
        "s2s",
        "none"
      ]
    },
    "tracking_value": {
      "type": [
        "string",
        "null"
      ]
    },
    "is_sample": {
      "type": "boolean",
      "description": "サンプルデータは true。production モードでは公開不可"
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "tracking_method"
        ],
        "properties": {
          "tracking_method": {
            "const": "none"
          }
        }
      },
      "then": {
        "properties": {
          "tracking_value": {
            "const": null
          }
        }
      },
      "x-rule": "CH01",
      "x-message-ja": "tracking_method=none なのに値がある:設定済み公式計測を記録するか値を null にしてください"
    },
    {
      "if": {
        "required": [
          "tracking_method"
        ],
        "properties": {
          "tracking_method": {
            "const": "portal_sub_id"
          }
        }
      },
      "then": {
        "properties": {
          "tracking_value": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_]{1,32}$"
          }
        }
      },
      "x-rule": "CH02",
      "x-message-ja": "ポータルで設定した sub ID を英数字で記録"
    }
  ]
}
dataset.schema.jsonJSON Schema 2020-12
schema/dataset.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "dataset.schema.json",
  "title": "dataset",
  "type": "object",
  "required": [
    "meta",
    "evidence",
    "offers",
    "campaigns",
    "products",
    "articles",
    "channels"
  ],
  "properties": {
    "meta": {
      "type": "object"
    },
    "evidence": {
      "type": "array",
      "items": {
        "$ref": "evidence.schema.json"
      }
    },
    "offers": {
      "type": "array",
      "items": {
        "$ref": "offer.schema.json"
      }
    },
    "campaigns": {
      "type": "array",
      "items": {
        "$ref": "campaign.schema.json"
      }
    },
    "products": {
      "type": "array",
      "items": {
        "$ref": "product.schema.json"
      }
    },
    "articles": {
      "type": "array",
      "items": {
        "$ref": "article.schema.json"
      }
    },
    "channels": {
      "type": "array",
      "items": {
        "$ref": "channel.schema.json"
      }
    }
  },
  "additionalProperties": false
}
evidence.schema.jsonJSON Schema 2020-12
schema/evidence.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "evidence.schema.json",
  "title": "evidence",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "type",
    "source",
    "captured_at",
    "url",
    "note_ja",
    "visibility",
    "is_sample"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
    },
    "type": {
      "enum": [
        "page_capture",
        "screenshot",
        "api_response",
        "portal_export",
        "manual_check"
      ]
    },
    "source": {
      "enum": [
        "public_page",
        "authorized_portal",
        "authorized_api",
        "operator_supply"
      ],
      "description": "公開情報、または用途が許諾されたデータのみ"
    },
    "captured_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "url": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^https://"
    },
    "note_ja": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 500
    },
    "visibility": {
      "enum": [
        "public",
        "internal"
      ],
      "description": "internal は出力に含めない(根拠の存在のみ参照)"
    },
    "is_sample": {
      "type": "boolean",
      "description": "サンプルデータは true。production モードでは公開不可"
    }
  }
}
offer.schema.jsonJSON Schema 2020-12
schema/offer.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "offer.schema.json",
  "title": "offer",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "type",
    "label_ja",
    "discount_type",
    "discount_value",
    "currency",
    "min_spend",
    "max_discount",
    "scope",
    "store_id",
    "product_ids",
    "eligibility",
    "code",
    "starts_at",
    "expires_at",
    "status",
    "stackable_with",
    "stacking_verified",
    "verified_at",
    "evidence_ids",
    "is_sample"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
    },
    "type": {
      "enum": [
        "platform_coupon",
        "store_coupon",
        "auto_discount",
        "promo_code"
      ]
    },
    "label_ja": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "discount_type": {
      "enum": [
        "fixed",
        "percent"
      ]
    },
    "discount_value": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "currency": {
      "const": "JPY"
    },
    "min_spend": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "利用条件の注文金額(円)。条件なしは null"
    },
    "max_discount": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "scope": {
      "enum": [
        "site",
        "store",
        "product"
      ]
    },
    "store_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "product_ids": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      }
    },
    "eligibility": {
      "enum": [
        "all",
        "new_user",
        "member",
        "app_only",
        "unknown"
      ]
    },
    "code": {
      "type": [
        "string",
        "null"
      ]
    },
    "starts_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "status": {
      "enum": [
        "active",
        "expired",
        "unknown"
      ],
      "description": "unknown は expired と同じではない。未確認として非公開"
    },
    "stackable_with": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      },
      "uniqueItems": true
    },
    "stacking_verified": {
      "type": "boolean"
    },
    "verified_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "evidence_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      },
      "uniqueItems": true
    },
    "is_sample": {
      "type": "boolean",
      "description": "サンプルデータは true。production モードでは公開不可"
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "const": "promo_code"
          }
        }
      },
      "then": {
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "x-rule": "O08",
      "x-message-ja": "promo_code はコード文字列が必須"
    },
    {
      "if": {
        "required": [
          "discount_type"
        ],
        "properties": {
          "discount_type": {
            "const": "percent"
          }
        }
      },
      "then": {
        "properties": {
          "discount_value": {
            "type": "number",
            "maximum": 99
          }
        }
      },
      "x-rule": "O07",
      "x-message-ja": "割引率は 99% 以下"
    },
    {
      "if": {
        "required": [
          "discount_type"
        ],
        "properties": {
          "discount_type": {
            "const": "fixed"
          }
        }
      },
      "then": {
        "properties": {
          "discount_value": {
            "type": "integer"
          }
        }
      },
      "x-rule": "O07",
      "x-message-ja": "定額割引は整数(円)"
    },
    {
      "if": {
        "required": [
          "scope"
        ],
        "properties": {
          "scope": {
            "const": "store"
          }
        }
      },
      "then": {
        "properties": {
          "store_id": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "x-rule": "O09",
      "x-message-ja": "scope=store には store_id が必須"
    },
    {
      "if": {
        "required": [
          "scope"
        ],
        "properties": {
          "scope": {
            "const": "product"
          }
        }
      },
      "then": {
        "properties": {
          "product_ids": {
            "type": "array",
            "minItems": 1
          }
        }
      },
      "x-rule": "O09",
      "x-message-ja": "scope=product には product_ids が必須"
    }
  ]
}
product.schema.jsonJSON Schema 2020-12
schema/product.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "product.schema.json",
  "title": "product",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "item_id",
    "sku_id",
    "title_ja",
    "category_ja",
    "store_id",
    "affiliate_url",
    "link_source",
    "link_generated_at",
    "link_policy",
    "affiliate_status",
    "affiliate_verified_at",
    "is_hot_product",
    "image",
    "stock_status",
    "ship_to_jp",
    "shipping_fee",
    "tax_included",
    "page_price",
    "currency",
    "scenario",
    "market_ref",
    "freshness_tier",
    "verified_at",
    "evidence_ids",
    "is_sample"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
    },
    "item_id": {
      "type": "string",
      "pattern": "^[0-9]{6,20}$"
    },
    "sku_id": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9]{6,25}$",
      "description": "指定 SKU。不明は null として保存できるが公開不可"
    },
    "title_ja": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "category_ja": {
      "type": "string",
      "minLength": 1
    },
    "store_id": {
      "type": "string",
      "minLength": 1
    },
    "affiliate_url": {
      "type": "string",
      "pattern": "^https://",
      "description": "公式生成原本、または設定済み S2S の許可追記リンク"
    },
    "link_source": {
      "enum": [
        "portal",
        "official_api",
        "official_tool"
      ]
    },
    "link_generated_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "link_policy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "original_url",
        "s2s_configured",
        "sub_affiliate_registered"
      ],
      "properties": {
        "mode": {
          "enum": [
            "official_original",
            "s2s"
          ]
        },
        "original_url": {
          "type": "string",
          "pattern": "^https://"
        },
        "s2s_configured": {
          "type": "boolean"
        },
        "sub_affiliate_registered": {
          "type": "boolean"
        }
      }
    },
    "affiliate_status": {
      "enum": [
        "affiliate",
        "non_affiliate",
        "unknown"
      ]
    },
    "affiliate_verified_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "is_hot_product": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "マーケティング対象。アフィリエイト資格とは別"
    },
    "image": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "rights"
      ],
      "properties": {
        "url": {
          "type": "string",
          "pattern": "^https://"
        },
        "rights": {
          "enum": [
            "official_api",
            "store_permitted",
            "own_photo",
            "unknown"
          ]
        }
      }
    },
    "stock_status": {
      "enum": [
        "in_stock",
        "out_of_stock",
        "unknown"
      ]
    },
    "ship_to_jp": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "shipping_fee": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "日本向け送料(円)。不明は null →「送料:要確認」"
    },
    "tax_included": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "page_price": {
      "type": "integer",
      "minimum": 1,
      "description": "検証時点の商品ページ表示価格(SKU・1点)"
    },
    "currency": {
      "const": "JPY"
    },
    "scenario": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "quantity",
        "ship_to",
        "eligibility",
        "applied_offer_ids",
        "conditional_offer_ids",
        "price_type",
        "display_price"
      ],
      "properties": {
        "quantity": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10
        },
        "ship_to": {
          "const": "JP"
        },
        "eligibility": {
          "enum": [
            "all",
            "new_user",
            "member",
            "app_only"
          ]
        },
        "applied_offer_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
          },
          "uniqueItems": true,
          "description": "適用順。各しきい値は直前までの割引後金額で判定"
        },
        "conditional_offer_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
          },
          "uniqueItems": true,
          "description": "価格に含めず「条件付き」として別表示する特典"
        },
        "price_type": {
          "enum": [
            "page_price",
            "verified_discounted_price"
          ]
        },
        "display_price": {
          "type": "integer",
          "minimum": 0,
          "description": "quantity 点の合計額。バリデータが再計算して照合"
        }
      },
      "allOf": [
        {
          "if": {
            "required": [
              "price_type"
            ],
            "properties": {
              "price_type": {
                "const": "page_price"
              }
            }
          },
          "then": {
            "properties": {
              "applied_offer_ids": {
                "type": "array",
                "maxItems": 0
              }
            }
          },
          "x-rule": "P09",
          "x-message-ja": "page_price の場合 applied_offer_ids は空"
        },
        {
          "if": {
            "required": [
              "price_type"
            ],
            "properties": {
              "price_type": {
                "const": "verified_discounted_price"
              }
            }
          },
          "then": {
            "properties": {
              "applied_offer_ids": {
                "type": "array",
                "minItems": 1
              }
            }
          },
          "x-rule": "P09",
          "x-message-ja": "verified_discounted_price には適用特典が 1 つ以上必要"
        }
      ]
    },
    "market_ref": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "required": [
        "price",
        "source_ja",
        "checked_at"
      ],
      "properties": {
        "price": {
          "type": "integer",
          "minimum": 1
        },
        "source_ja": {
          "type": "string",
          "minLength": 1
        },
        "checked_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
        }
      }
    },
    "freshness_tier": {
      "enum": [
        "hot",
        "standard"
      ]
    },
    "verified_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601。タイムゾーン必須(例: 2026-11-18T09:30:00+09:00)"
    },
    "evidence_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{1,63}$"
      },
      "uniqueItems": true
    },
    "is_sample": {
      "type": "boolean",
      "description": "サンプルデータは true。production モードでは公開不可"
    }
  }
}
05

コマンド

Node.js 18 以上。追加パッケージ不要
validator.js
# 検証のみ(ディレクトリなら dataset.json、なければエンティティ別ファイルを読む)
node validator.js data

# 本番:エラーがあれば終了コード 2、公開可データを出力
node validator.js data --mode production --out site/data/publishable.json --strict

# ブラウザ用(window.AE_PUBLISHABLE = …)
node validator.js data --mode production --out starter/data/publishable.js

# 時刻を固定して再現(サンプル・テスト用)
node validator.js sample --now 2026-11-18T12:00:00+09:00

# 機械可読の結果 / JSON Schema の書き出し
node validator.js data --json
node validator.js --schemas schema