Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Layanan API biasanya menggunakan file .proto untuk menentukan permukaan API dan file .yaml untuk mengonfigurasi layanan API. Setiap layanan API harus memiliki
direktori API di dalam repositori API. Direktori API harus
berisi semua file definisi API dan skrip build.
Setiap direktori API harus memiliki tata letak standar berikut:
Direktori API
Prasyarat repositori
BUILD - File build.
METADATA - File metadata build.
OWNERS - Pemilik direktori API.
README.md - Informasi umum tentang layanan API.
File konfigurasi
{service}.yaml - File konfigurasi layanan dasar, yang merupakan
representasi YAML dari pesan proto google.api.Service.
prod.yaml - File konfigurasi layanan delta prod.
staging.yaml - File konfigurasi layanan delta penyiapan.
test.yaml - File konfigurasi layanan delta pengujian.
local.yaml - File konfigurasi layanan delta lokal.
File dokumentasi
doc/* - File dokumentasi teknis. Harus dalam format Markdown.
Definisi antarmuka
v[0-9]*/* - Setiap direktori tersebut berisi versi utama
API, terutama file proto dan skrip build.
{subapi}/v[0-9]*/* - Setiap direktori {subapi} berisi definisi antarmuka sub-API. Setiap sub-API dapat memiliki versi utama independennya sendiri.
type/* - file proto yang berisi jenis yang dibagikan di antara
API yang berbeda, versi API yang sama, atau antara
API dan implementasi layanan. Definisi jenis di bagian type/*seharusnya tidak memiliki perubahan yang dapat menyebabkan gangguan setelah dirilis.
Definisi Google API publik dipublikasikan di GitHub, lihat repositori Google APIs.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 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,["# Directory structure\n\nAPI services typically use `.proto` files to define the API surface and\n`.yaml` files to configure the API service. Each API service **must** have\nan API directory inside an API repository. The API directory **should**\ncontain all API definition files and build scripts.\n\nEach API directory **should** have the following standard layout:\n\n- API directory\n\n - Repository prerequisites\n\n - `BUILD` - The build file.\n - `METADATA` - The build metadata file.\n - `OWNERS` - The API directory owners.\n - `README.md` - The general information about the API service.\n - Configuration files\n\n - `{service}.yaml` - The baseline service config file, which is the YAML representation of the `google.api.Service` proto message.\n - `prod.yaml` - The prod delta service config file.\n - `staging.yaml` - The staging delta service config file.\n - `test.yaml` - The test delta service config file.\n - `local.yaml` - The local delta service config file.\n - Documentation files\n\n - `doc/*` - The technical documentation files. They should be in Markdown format.\n - Interface definitions\n\n - `v[0-9]*/*` - Each such directory contains a major version of the API, mainly the proto files and build scripts.\n - `{subapi}/v[0-9]*/*` - Each `{subapi}` directory contains interface definition of a sub-API. Each sub-API may have its own independent major version.\n - `type/*` - proto files containing types that are shared between different APIs, different versions of the same API, or between the API and service implementation. Type definitions under `type/*` **should** not have breaking changes once they are released.\n\nPublic Google API definitions are published on GitHub, see\n[Google APIs](https://github.com/googleapis/googleapis) repository.\n| **Note:** If you are a [Cloud Endpoints](/endpoints) developer, you can follow [Configuring a gRPC service](/endpoints/docs/grpc/grpc-service-config) to configure your API service."]]