ディレクトリ構造
API サービスは通常、.proto
ファイルを使用して API サーフェスを定義し、.yaml
ファイルを使用して API サービスを構成します。各 API サービスで、API ディレクトリが API リポジトリ内にあることが必須となります。API ディレクトリには、API 定義ファイルとビルド スクリプトがすべて含まれる必要があります。
各 API ディレクトリは、次の標準レイアウトにすることが推奨されます。
API ディレクトリ
リポジトリの前提条件
BUILD
- ビルドファイル。
METADATA
- ビルド メタデータ ファイル。
OWNERS
- API ディレクトリのオーナー。
README.md
- API サービスに関する一般的な情報。
構成ファイル
{service}.yaml
- ベースライン サービス構成ファイル。これは google.api.Service
proto メッセージの YAML 表現です。
prod.yaml
- 本番デルタ サービス構成ファイル。
staging.yaml
- ステージング デルタ サービス構成ファイル。
test.yaml
- テスト デルタ サービス構成ファイル。
local.yaml
- ローカル デルタ サービス構成ファイル。
ドキュメント ファイル
doc/*
- 技術ドキュメント ファイル。Markdown 形式にします。
インターフェース定義
v[0-9]*/*
- 各ディレクトリには、API のメジャー バージョン(主に proto ファイルとビルド スクリプト)が含まれています。
{subapi}/v[0-9]*/*
- 各 {subapi}
ディレクトリにはサブ API のインターフェース定義が含まれています。各サブ API には独自のメジャー バージョンを持つことができます。
type/*
- 異なる API 間、同じ API の異なるバージョン間、または API とサービスの実装間で共有される型を含む proto ファイル。type/*
の下にある型定義には、リリース後に互換性を損なう変更を加えるべきではありません。
公開 Google API の定義は、GitHub で公開されています。Google API リポジトリをご覧ください。ディレクトリ構造の詳細については、Service Infrastructure のサンプル API をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-04-30 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-04-30 UTC。"],[[["\u003cp\u003eAPI services utilize \u003ccode\u003e.proto\u003c/code\u003e files for API definition and \u003ccode\u003e.yaml\u003c/code\u003e files for service configuration.\u003c/p\u003e\n"],["\u003cp\u003eEach API service must reside in an API directory within an API repository, containing all definition files and build scripts.\u003c/p\u003e\n"],["\u003cp\u003eAn API directory should follow a standard layout including repository prerequisites, configuration files, documentation files, and interface definitions, like versioned sub-API directories, and type files for shared proto files.\u003c/p\u003e\n"],["\u003cp\u003ePublic Google API definitions are available on the \u003ca href=\"https://github.com/googleapis/googleapis\"\u003eGoogle APIs\u003c/a\u003e GitHub repository, as seen with the \u003ca href=\"https://github.com/googleapis/googleapis/tree/master/google/example/endpointsapis\"\u003eService Infrastructure Example API\u003c/a\u003e.\u003c/p\u003e\n"]]],[],null,[]]