目录结构
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
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/*
:proto 文件,包含在不同 API 之间、同一 API 的不同版本之间或 API 与服务实现之间共享的类型。type/*
下的类型定义一旦发布就不应该有破坏性更改。
公共 Google API 定义在 GitHub 上发布,请参阅 Google API 代码库。如需详细了解目录结构,请参阅 Service Infrastructure 示例 API。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-02-18。
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]