Files
mintlify__docs/zh/integrations/sdks/speakeasy.mdx
locadex-agent[bot] 9d82233e1c docs(locadex): add translations (#4029)
Co-authored-by: locadex-agent[bot] <217277504+locadex-agent[bot]@users.noreply.github.com>
2026-03-04 16:49:02 -08:00

86 lines
3.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Speakeasy"
description: "在你的 API 操作台中展示由 Speakeasy 自动生成的多语言 SDK 代码示例。"
keywords: ["Speakeasy SDK", "autogenerated SDKs", "SDK code samples", "API playground integration"]
---
你可以将来自 Speakeasy SDK 的自动生成代码片段直接集成到 Mintlify 的 API 参考文档中。这些 SDK 使用示例将显示在由 Mintlify 驱动的文档站点的[交互式操作台](/zh/api-playground/overview)中。
<Frame>
![带有 Speakeasy 代码片段的 Mintlify API 操作台。](/images/speakeasy/mintlify-with-speakeasy-openapi.png)
</Frame>
<div id="prerequisites">
## 前提条件
</div>
要将 Mintlify 与 Speakeasy 集成,你需要:
* 一个 [Mintlify 文档存储库](/zh/quickstart)。
* 一个由 Speakeasy 生成的 SDK,并已配置[自动代码示例 URL](https://www.speakeasy.com/docs/code-samples/automated-code-sample-urls)。
<div id="setting-up-the-integration">
## 设置集成
</div>
要将 Speakeasy 与 Mintlify 集成,你需要从注册中心获取该 API 的合并规范的公共 URL,并更新你的 `docs.json` 配置文件。
<div id="get-the-apis-combined-spec-public-url-from-the-registry">
### 从注册表获取 API 的合并规范公开 URL
</div>
前往你的 [Speakeasy 控制台](https://app.speakeasy.com),打开 **API Registry** 标签页。打开该 API 的 `*-with-code-samples` 条目。
<Frame>
![Speakeasy API Registry 页面截图。API Registry 标签页以红色方框和数字 1 标注,API 的条目以红色方框和数字 2 标注。](/images/speakeasy/openapi-registry-and-combined-spec.png)
</Frame>
<Note>
如果该条目未标记为 **Combined Spec**,请确保该 API 已配置[自动代码示例 URL](https://www.speakeasy.com/docs/code-samples/automated-code-sample-urls)。
</Note>
在该注册表条目的页面上,复制提供的公开 URL。
<Frame>
![显示合并规范注册表条目的截图,其中“复制 URL”功能以红色方框突出显示。](/images/speakeasy/copy-combined-spec-url.png)
</Frame>
<div id="update-your-docsjson-configuration-file">
### 更新你的 `docs.json` 配置文件
</div>
将合并后的规范 URL 添加到 `docs.json` 文件中的 **Anchors** 或 **Tabs** 部分。
在 `docs.json` 文件中按如下方式更新 `anchor` 字段,将合并后的规范 URL 添加到对应锚点:
```json docs.json
{
"anchors": [
{
"name": "API Reference",
// !mark
"openapi": "SPEAKEASY_COMBINED_SPEC_URL",
"url": "api-reference",
"icon": "square-terminal"
}
]
}
```
通过如下方式在 `docs.json` 文件中更新 `tab` 字段,将合并后的规范 URL 添加到一个标签页中:
```json docs.json
{
"tabs": [
{
"name": "API Reference",
"url": "api-reference",
// !mark
"openapi": "SPEAKEASY_COMBINED_SPEC_URL"
}
]
}
```
现在,你可以在 API 文档中查看 Speakeasy 生成的代码片段,并在演示区中与它们交互。