API Versioning
APIバージョン管理
APIのバージョン管理は、クライアントを壊すことなくAPI契約を命名、変更、サポート、廃止するための計画です。すべてのAPIが使用すべき単一のURLやヘッダスタイルはありません。
もう一つの例
給与 API は OpenAPI 契約 `2026-07` を公開し、 `/v1` クライアントの動作を維持します。オプションフィールドを追加しても既存のクライアントは壊れません。 `netPay` を整数セントから小数に変更するには、新しいメジャー契約が必要です。また、移行ガイド、非推奨ヘッダー、使用データ、廃止日も必要です。
主な部分
- 01契約識別子
- 02互換性ルール
- 03非推奨と移行
以下の場合に使用します
互換性ルール、変更タイプ、検出方法、サポート期間、廃止方針を最初に設定します。その後、パス、メディアタイプ、またはヘッダースタイルを選択します。
以下の場合は使用しないでください
すべてのリリースごとに新しいAPIバージョンを作成しないでください。使用データや古いバージョンを廃止する方法がないまま、永続的なサポートを約束しないでください。
コードで使用する名前
explicit compatibility policy + versioned OpenAPI document + deprecation and sunset lifecycle 出荷前に
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome:Complete the task with APIバージョン管理 (API Versioning)。 User context:給与 API は OpenAPI 契約 `2026-07` を公開し、 `/v1` クライアントの動作を維持します。オプションフィールドを追加しても既存のクライアントは壊れません。 `netPay` を整数セントから小数に変更するには、新しいメジャー契約が必要です。また、移行ガイド、非推奨ヘッダー、使用データ、廃止日も必要です。 Technical concept or control:APIバージョン管理 (API Versioning)。 Why it fits:互換性ルール、変更タイプ、検出方法、サポート期間、廃止方針を最初に設定します。その後、パス、メディアタイプ、またはヘッダースタイルを選択します。 Do not use it when:すべてのリリースごとに新しいAPIバージョンを作成しないでください。使用データや古いバージョンを廃止する方法がないまま、永続的なサポートを約束しないでください。 Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary):単一の公式標準が全体の用語を管理するわけではありません。その意味はチーム、プラットフォーム、またはフレームワークによって変わる可能性があります。 Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
このリクエストを確認する
Review how APIバージョン管理 (API Versioning) is used now. Definition: APIのバージョン管理は、クライアントを壊すことなくAPI契約を命名、変更、サポート、廃止するための計画です。すべてのAPIが使用すべき単一のURLやヘッダスタイルはありません。 Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.