generators.yml 配置模式

以 Markdown 格式查看

generators.yml 文件有两个作用:它声明您的 API 定义(OpenAPI/AsyncAPI 必需),并配置 SDK 生成,包括生成哪些语言、发布位置以及如何自定义每个 SDK。

要在编辑器中启用智能 YAML 验证和自动补全功能,请在 generators.yml 文件顶部添加模式指令。

generators.yml
1# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
2api:
3 specs:
4 - openapi: "./openapi.yml"
5 namespace: "v1"
6 settings:
7 title-as-schema-name: true
8 inline-path-parameters: false
9 respect-forward-compatible-enums: true
10
11whitelabel:
12 github:
13 username: "my-org"
14 email: "sdk@mycompany.com"
15 token: "ghp_xxxxxxxxxxxx"
16
17metadata:
18 description: "MyAPI 官方 SDK"
19 authors:
20 - name: "SDK 团队"
21 email: "sdk@mycompany.com"
22
23readme:
24 introduction: "欢迎使用 MyAPI SDK"
25 apiReferenceLink: "https://docs.myapi.com"
26 defaultEndpoint:
27 method: "GET"
28 path: "/users"
29 features:
30 authentication:
31 - "POST /auth/login"
32 - "GET /auth/profile"
33 users:
34 - "GET /users"
35 - "POST /users"
36
37default-group: "production"
38
39groups:
40 production:
41 generators:
42 - name: fernapi/fern-typescript-sdk
43 version: 0.9.0
44 - name: fernapi/fern-python-sdk
45 version: 2.0.0

auth-schemes

为您的 SDK 和 API 浏览器 定义身份验证方法,您的端点可以引用这些方法。在 generators.yml 中定义的身份验证方案优先于在规范中定义的身份验证方案

定义身份验证方案后,必须使用 api.auth 将其作为默认值应用于所有端点。或者,如果需要针对不同语言的不同身份验证行为,可以为单个 SDK 定义身份验证

generators.yml
1auth-schemes:
2 # 用户定义的方案名称 - 最小配置的 OAuth
3 simple-oauth:
4 scheme: oauth
5 type: client-credentials
6 get-token:
7 endpoint: "auth.token"
8
9 # 用户定义的方案名称 - 自定义配置的 Header 身份验证
10 custom-header:
11 name: "Custom Auth"
12 header: "X-Custom-Auth"
13 prefix: "Custom "
14 env: "CUSTOM_TOKEN"
15
16 # 用户定义的方案名称 - Basic 身份验证
17 http-basic:
18 scheme: basic
19
20 # 用户定义的方案名称 - Bearer token
21 jwt-bearer:
22 scheme: bearer

选择自定义 header(API 密钥)、HTTP Basic、Bearer token 或 OAuth 2.0 身份验证:

Configure HTTP Basic authentication using username and password credentials.

1auth-schemes:
2 basic-auth: # User-defined scheme name
3 scheme: basic
4 username:
5 name: "Username"
6 env: "BASIC_AUTH_USERNAME" # SDK will auto-scan this environment variable
7 password:
8 name: "Password"
9 env: "BASIC_AUTH_PASSWORD" # SDK will auto-scan this environment variable
scheme
'basic'Required

Must be set to "basic" for Basic authentication schemes.

username
object

Configuration for the username credential.

username.name
string

Custom parameter name for the username in the generated SDK. If not specified, defaults to "username". Use this to provide more descriptive or domain-specific parameter names like "clientId", "userEmail", or "merchantId".

password
object

Configuration for the password credential.

password.name
string

Custom parameter name for the password in the generated SDK. If not specified, defaults to "password". Use this to provide more descriptive or domain-specific parameter names like "clientSecret", "apiKey", or "merchantKey".

username.env, password.env
string

Environment variable name that the SDK will automatically scan for the username or password value. When this environment variable is present, users don’t need to explicitly provide the username parameter. Follow naming conventions like YOUR_APP_USERNAME or SERVICE_CLIENT_ID.

Configure Bearer token authentication for API access.

1auth-schemes:
2 bearer-token: # User-defined scheme name
3 scheme: bearer
4 token:
5 name: "Access Token"
6 env: "BEARER_TOKEN" # SDK will auto-scan this environment variable
scheme
'bearer'Required

Must be set to "bearer" for Bearer token authentication schemes.

token
object

Configuration for the bearer token.

token.name
string

A descriptive name for the token.

token.env
string

Environment variable name containing the bearer token. When specified, the generated SDK will automatically scan for this environment variable at initialization.

For Fern Definition, you can configure OAuth authentication either in generators.yml or directly in your api.yml file. For OpenAPI, OAuth must be configured in generators.yml.

Configure OAuth 2.0 client credentials authentication. Optionally configure a refresh-token endpoint for token renewal without re-authentication.

generators.yml
1auth-schemes:
2 my-oauth: # User-defined scheme name
3 scheme: oauth
4 type: client-credentials
5 scopes:
6 - "read:users"
7 - "write:users"
8 client-id-env: "OAUTH_CLIENT_ID" # SDK will auto-scan this environment variable
9 client-secret-env: "OAUTH_CLIENT_SECRET" # SDK will auto-scan this environment variable
10 token-prefix: "Bearer"
11 token-header: "Authorization"
12 get-token:
13 endpoint: "auth.get_token"
14 request-properties:
15 client-id: "clientId"
16 client-secret: "clientSecret"
17 scopes: "scope"
18 response-properties:
19 access-token: "access_token"
20 expires-in: "expires_in"
21 refresh-token: "refresh_token"
22 refresh-token:
23 endpoint: "auth.refresh_token"
24 request-properties:
25 refresh-token: "refreshToken"
26 response-properties:
27 access-token: "access_token"
28 expires-in: "expires_in"
29 refresh-token: "refresh_token"
scheme
'oauth'Required

Must be set to "oauth" for OAuth authentication schemes.

type
'client-credentials'Required

The OAuth 2.0 grant type. Currently only "client-credentials" is supported.

scopes
list of strings

OAuth scopes to request when obtaining access tokens (e.g., "read:users", "write:orders").

client-id-env
string

Environment variable name containing the OAuth client ID. When specified, the generated SDK will automatically scan for this environment variable at initialization.

client-secret-env
string

Environment variable name containing the OAuth client secret. When specified, the generated SDK will automatically scan for this environment variable at initialization.

token-prefix
stringDefaults to Bearer

Prefix added to the access token in the Authorization header (e.g., "Bearer" results in "Authorization: Bearer <token>"). Useful when your API expects a custom format.

token-header
stringDefaults to Authorization

HTTP header name used to send the access token. Defaults to "Authorization" but can be customized if your API uses a different header (e.g., "X-API-Token").

get-token

Specifies the endpoint that exchanges client credentials for an access token. This endpoint is called automatically when the SDK client is initialized.

generators.yml
1get-token:
2 endpoint: "auth.get_token"
3 request-properties:
4 client-id: "clientId"
5 client-secret: "clientSecret"
6 response-properties:
7 access-token: "access_token"
8 expires-in: "expires_in"
endpoint
stringRequired

The endpoint that issues access tokens, such as 'auth.get_token' or 'POST /oauth/token'. If your API uses namespaces, prefix with the namespace and :: (e.g., 'payments::POST /oauth/token').

request-properties
object

Maps OAuth parameter names to your API’s request field names. Use this when your token endpoint expects different field names than the OAuth standard (e.g., your API uses clientId instead of client_id).

request-properties.client-id
string

The request field name for the client ID in your API (e.g., "clientId", "client_id").

request-properties.client-secret
string

The request field name for the client secret in your API (e.g., "clientSecret", "client_secret").

request-properties.scopes
string

The request field name for scopes in your API (e.g., "scope", "scopes").

response-properties
object

Maps your API’s response field names to OAuth standard names. Use this when your API returns tokens with different field names (e.g., accessToken instead of access_token).

response-properties.access-token
string

The response field name for the access token in your API (e.g., "accessToken", "access_token").

response-properties.expires-in
string

The response field name for token expiration time in seconds (e.g., "expiresIn", "expires_in"). When present, the SDK automatically refreshes tokens before expiration.

refresh-token
string

The response field name for the refresh token in your API (e.g., "refreshToken", "refresh_token"). Required if using the refresh-token flow.

refresh-token

Specifies the endpoint that exchanges a refresh token for a new access token. When configured, the SDK automatically uses this endpoint to renew expired tokens without re-sending credentials. If not configured, the SDK will re-authenticate using get-token when tokens expire.

generators.yml
1refresh-token:
2 endpoint: "auth.refresh_token"
3 request-properties:
4 refresh-token: "refreshToken"
5 response-properties:
6 access-token: "access_token"
7 expires-in: "expires_in"
endpoint
stringRequired

The endpoint that refreshes access tokens (e.g., "POST /oauth/refresh" or "auth.refreshToken"). If your API uses namespaces, prefix with the namespace and :: (e.g., "payments::POST /oauth/refresh").

request-properties
object

Maps OAuth parameter names to your API’s request field names for the refresh flow.

request-properties.refresh-token
stringRequired

The request field name for the refresh token in your API (e.g., "refreshToken", "refresh_token").

response-properties
object

Maps your API’s refresh response field names to OAuth standard names.

response-properties.access-token
string

The response field name for the new access token (e.g., "accessToken", "access_token").

response-properties.expires-in
string

The response field name for the new token’s expiration time in seconds (e.g., "expiresIn", "expires_in").

response-properties.refresh-token
string

The response field name if your API issues a new refresh token with each refresh (token rotation).

api

定义 API 规范(OpenAPI、AsyncAPI 等)以及如何解析它。对于 Fern 定义,不需要 API 引用 — Fern 自动检测您的规范

generators.yml
1api:
2 settings:
3 inline-path-parameters: true # 应用于所有 OpenAPI 规范
4 specs:
5 - openapi: "./openapi.yml"
6 namespace: "v1"
7 settings:
8 title-as-schema-name: true # 仅应用于此 OpenAPI 规范
9 - asyncapi: "./events.yml"
10 namespace: "events"
11 headers:
12 Authorization: "Bearer ${API_TOKEN}"
13 environments:
14 production: "https://api.prod.com"
15 staging: "https://api.staging.com"
auth
string

为所有端点设置默认身份验证方案。该值必须引用在 auth-schemes 中定义的方案名称。这将覆盖在 OpenAPI 规范中定义的任何安全方案。

generators.yml
1# 将其作为所有端点的默认值
2api:
3 auth: BearerAuth # 在 auth-schemes 中定义
4 specs:
5 - openapi: ./openapi.yml

使用此配置,所有生成的 SDK 都将要求使用 BearerAuth 方案进行身份验证:

index.ts
1// 使用 process.env.PLANTSTORE_API_KEY
2const client = new PlantStoreClient();
3
4// 或显式提供 API 密钥
5const client = new PlantStoreClient({
6 apiKey: "your-api-key"
7});

您还可以使用生成器级别的 api.auth 设置为单个生成器覆盖身份验证。

headers
string or list of objects

包含在所有 API 请求中的全局 header。这是在 OpenAPI 规范中配置全局 header 的替代方案。您可以将 header 指定为简单的字符串值,或作为具有代码生成附加配置的对象。

generators.yml
1api:
2 headers:
3 Authorization: "Bearer ${API_TOKEN}"
4 X-App-Version: "1.0.0"
generators.yml
1api:
2 - openapi: ./path/to/openapi
3 headers:
4 X-Version:
5 # 在生成的 SDK 代码中使用的变量名称。
6 # 如果未指定,使用 header 名称。
7 name: version
8 # 用于代码生成的 header 值类型
9 # (例如,"string"、"literal<'value'>"、"number")。
10 type: literal<"1234">
environments
object

不同部署目标的环境配置。

settings
object

应用于给定类型的所有规范(例如,所有 OpenAPI 规范)的设置。可以在规范或生成器级别覆盖。优先级:生成器级别设置覆盖规范级别设置,规范级别设置覆盖全局设置。

例如,使用此功能确保所有 OpenAPI 规范的解析行为一致。有关可用设置,请参阅下面的规范类型文档。

规范类型

每种规范类型(OpenAPI、AsyncAPI 等)都支持各种配置选项,包括规范文件位置、命名空间、覆盖和特定类型的设置。

generators.yml
1api:
2 specs:
3 - openapi: "./openapi.yml"
4 origin: "https://api.example.com/openapi.json"
5 overlays: "./openapi-overlays.yml"
6 overrides: "./openapi-overrides.yml" # or a list of paths
7 namespace: "v1"
8 settings:
9 title-as-schema-name: true
10 inline-path-parameters: false
11 inline-all-of-schemas: true
12 prefer-undiscriminated-unions-with-literals: true
13 filter:
14 endpoints: ["POST /users", "GET /users/{id}"]
15 example-generation:
16 request:
17 max-depth: 2
openapi
stringRequired

OpenAPI 规范文件的路径。

origin
string

用于拉取更新的 API 定义源 URL。有关如何设置自动同步的说明,请参阅 同步您的 OpenAPI 规范

overlays
string

OpenAPI Overlay 文件的路径。Overlay 遵循 OpenAPI Overlay 规范,是自定义 OpenAPI 规范的推荐方法。

overrides
string | list of strings

OpenAPI 覆盖 文件的路径,或按顺序应用的多个覆盖文件路径列表。建议使用 overlays 来实现基于标准的方法。

1# 单个覆盖文件
2overrides: ./overrides.yml
3
4# 多个覆盖文件(按顺序应用)
5overrides:
6 - ./base-overrides.yml
7 - ./sdk-overrides.yml
namespace
string

规范的命名空间。用于配置 包含多个 API 版本的单个包

settings
object

此单独规范的 OpenAPI 特定生成设置。要在所有 OpenAPI 规范中应用相同的设置,请改用全局 api.settings

settings.title-as-schema-name
booleanDefaults to false

是否将 OpenAPI 定义中模式的标题用作 Fern 中类型的名称。

settings.inline-path-parameters
booleanDefaults to true

是否在生成的内联请求中包含路径参数。

settings.inline-all-of-schemas
booleanDefaults to false

是否在代码生成期间内联 allOf 模式。当为 true 时,Fern 递归访问 allOf 模式定义并将它们内联到子模式中。当为 false 时,allOf 模式通过继承进行扩展。

启用此设置允许子模式覆盖父属性要求。例如,子模式可以将父级的必需属性标记为可选。如果没有此设置,Fern 会忽略子模式的可选声明,而是保留父模式的要求。

settings.prefer-undiscriminated-unions-with-literals
booleanDefaults to false

是否首选包含字面量的无区别联合。

settings.only-include-referenced-schemas
booleanDefaults to false

是否仅在生成的 SDK 中包含由端点引用的模式(树摇动)。

settings.respect-nullable-schemas
booleanDefaults to true

保留 API 定义设置中的可空模式。当为 false 时,可空模式被视为可选。

settings.object-query-parameters
booleanDefaults to true

启用解析深层对象查询参数。

settings.wrap-references-to-nullable-in-optional
booleanDefaults to false

控制是否将对可空模式的引用包装在可选类型中。当为 false 时,可空引用被视为可以为 null 的必需字段。

settings.coerce-optional-schemas-to-nullable
booleanDefaults to false

控制在代码生成期间是否将可选模式强制转换为可空类型。当为 false 时,可选和可空被视为不同的概念。

settings.respect-readonly-schemas
boolean

启用在 OpenAPI 规范中探索只读模式。

settings.respect-forward-compatible-enums
booleanDefaults to false

启用在 OpenAPI 规范中遵循前向兼容枚举。

settings.use-bytes-for-binary-response
boolean

启用对二进制响应使用 bytes 类型。默认为文件流。

settings.default-form-parameter-encoding
stringDefaults to json

表单参数的默认编码。选项:formjson

settings.additional-properties-defaults-to
booleanDefaults to false

配置当模式中没有明确定义时,additionalProperties 应默认为什么。

settings.type-dates-as-strings
booleanDefaults to false

如果为 true,将格式为 date 的字符串转换为字符串。如果为 false,转换为日期。

settings.preserve-single-schema-oneof
booleanDefaults to false

如果为 true,保留具有单个模式的 oneOf 结构。如果为 false,展开它们。

settings.filter
object

应用于 OpenAPI 规范的过滤器。使用此功能来限制生成的 SDK 或 API 参考文档中包含的端点 基于其路径

如需基于标签的过滤而非基于路径的过滤,请在 group 级别使用 audiences

settings.filter.endpoints
list of strings

要包含在生成的 SDK 中的端点。以 METHOD /path 格式指定端点(例如,POST /usersGET /users/{id})。只有列出的端点才会包含在生成的 SDK 中;所有其他端点将被排除。如果您的 API 使用 命名空间,请使用命名空间和 :: 前缀(例如,payments::POST /users)。

settings.example-generation.request.max-depth
integer

控制为可选属性生成示例的最大深度。深度为 0 意味着不会为任何可选属性生成示例。

settings.example-generation.response.max-depth
integer

控制在响应中为可选属性生成示例的最大深度。

settings.coerce-enums-to-literals
booleanDefaults to false

控制在代码生成期间是否将枚举转换为字面量类型。当为 false(默认值)时,枚举作为枚举类型保留,维护 OpenAPI 规范中的原始枚举结构。当为 true 时,枚举被强制转换为字面量类型,这对于生成的代码中更简单的类型表示很有用。

settings.idiomatic-request-names
booleanDefaults to true

控制自动生成的请求名称的命名约定。启用时,在请求名称中将动词置于名词之前(例如,UsersListRequest 变为 ListUsersRequest),遵循更符合习惯的命名模式。

settings.resolve-aliases
booleanDefaults to false

内联类型别名以简化生成的 SDK。启用时,通过直接用其底层类型替换简单别名来减少不必要的类型定义。对于具有许多基本类型或简单类型别名的 OpenAPI 规范很有用。

设置为 true 以内联所有别名,或使用带有 except 数组的对象来保留特定的类型别名:

1settings:
2 # 内联所有别名
3 resolve-aliases: true
4
5 # 或保留特定别名
6 resolve-aliases:
7 except:
8 - UserId
9 - OrganizationId
settings.group-environments-by-host
booleanDefaults to false

启用时,按主机将服务器分组到统一环境中,使具有多种协议(REST、WebSocket 等)的 API 能够共享环境配置。环境 URL ID 使用服务器名称,仅在需要解决冲突时添加路径或协议后缀。

1api:
2 specs:
3 - asyncapi: "./asyncapi.yml"
4 origin: "https://api.example.com/asyncapi.json"
5 overrides: "./asyncapi-overrides.yml" # 或路径列表
6 namespace: "events"
7 settings:
8 message-naming: "v2"
9 title-as-schema-name: false
10 respect-nullable-schemas: true
asyncapi
stringRequired

AsyncAPI 规范文件的路径。

origin
string

用于拉取更新的 API 定义源 URL。

overrides
string | list of strings

AsyncAPI 覆盖文件的路径,或按顺序应用的多个覆盖文件的路径列表。

1# 单个覆盖文件
2overrides: ./asyncapi-overrides.yml
3
4# 多个覆盖文件(按顺序应用)
5overrides:
6 - ./base-overrides.yml
7 - ./sdk-overrides.yml
namespace
string

规范的命名空间。对于配置具有多个 API 版本的单个包很有用。

settings
object

此单个规范的 AsyncAPI 特定生成设置。要在所有 AsyncAPI 规范中应用相同的设置,请改用全局 api.settings

settings.message-naming
objectDefaults to v1

用于 AsyncAPI 消息的消息命名版本。选项:v1v2

settings.title-as-schema-name
booleanDefaults to false

是否使用 AsyncAPI 定义中模式的标题作为 Fern 中类型的名称。

settings.respect-nullable-schemas
booleanDefaults to true

在 API 定义设置中保留可为 null 的模式。当为 false 时,可为 null 的模式被视为可选的。

settings.idiomatic-request-names
booleanDefaults to true

控制自动生成的请求名称的命名约定。启用时,在请求名称中将动词放在名词之前(例如,UsersListRequest 变为 ListUsersRequest),遵循更惯用的命名模式。

settings.wrap-references-to-nullable-in-optional
booleanDefaults to false

控制是否将对可为 null 模式的引用包装在可选类型中。当为 false 时,可为 null 的引用被视为可以为 null 的必需字段。

settings.coerce-optional-schemas-to-nullable
booleanDefaults to false

控制在代码生成期间是否将可选模式强制转换为可为 null 类型。当为 false 时,可选和可为 null 被视为不同的概念。

settings.group-environments-by-host
booleanDefaults to false

启用时,按主机将服务器分组到统一环境中,使具有多个协议(REST、WebSocket 等)的 API 能够共享环境配置。环境 URL ID 使用服务器名称,仅在需要解决冲突时才添加路径或协议后缀。

generators.yml
1api:
2 specs:
3 - proto:
4 root: "./proto"
5 target: "proto/service/v1/service.proto"
6 local-generation: true
root
stringRequired

.proto 目录根目录的路径(例如 proto)。必须指定到包开始的位置。例如,如果您的包是 package.test.v1,文件路径为 protos/package/test/v1/test_file.proto,那么根目录应该是 protos/

target
string

到目标 .proto 文件的路径(例如 proto/user/v1/user.proto)。省略此参数将为整个根文件夹生成文档。

overrides
string | list of strings

重写配置文件的路径,或者按顺序应用的多个重写文件的路径列表。仅用于 SDK 生成,不用于文档生成。

1# 单个重写文件
2overrides: ./overrides.yml
3
4# 多个重写文件(按顺序应用)
5overrides:
6 - ./base-overrides.yml
7 - ./sdk-overrides.yml
local-generation
booleanDefaults to false

是否在本地编译 .proto 文件。默认使用远程生成(false)。启用时,您必须在您的机器上或在您的 CI/CD 环境(例如 GitHub Actions) 中安装 buf

.openrpc
stringRequired

OpenRPC 规范文件的路径。

overrides
string | list of strings

OpenRPC 覆盖文件的路径,或按顺序应用的多个覆盖文件的路径列表。

1# 单个覆盖文件
2overrides: ./overrides.yml
3
4# 多个覆盖文件(按顺序应用)
5overrides:
6 - ./base-overrides.yml
7 - ./sdk-overrides.yml
namespace
string

规范的命名空间。

generators.yml
1api:
2 specs:
3 conjure: "./conjure-api.yml"
conjure
string

Conjure 规范文件的路径。

whitelabel

发布不带 Fern 品牌的生成 SDK 的配置。启用时,从生成的代码中删除所有对 Fern 的提及,并允许在您自己的品牌下发布。

generators.yml
1whitelabel:
2 github:
3 username: "company-github-username"
4 email: "my-email@example.com"
5 token: "ghp_xxxxxxxxxxxx"
username
stringRequired

用于提交和将白标 SDK 代码发布到 GitHub 存储库的 GitHub 用户名。这应该是对您的目标存储库具有写入权限的帐户的用户名。

email
stringRequired

与 GitHub 帐户关联的电子邮件地址。此电子邮件将在发布白标 SDK 代码时在 Git 提交中使用,并应与您的 GitHub 帐户设置中配置的电子邮件匹配。

token
stringRequired

具有适当存储库访问权限的 GitHub 个人访问令牌 (PAT)。令牌应具有 repo 范围权限,以允许读取和写入存储库来发布白标 SDK。

metadata

包含在所有生成的 SDK 中的包元数据,如描述和作者。或者,您可以为单个 SDK 定义元数据

generators.yml
1metadata:
2 description: "我的 API SDK"
3 authors:
4 - name: "John Doe"
5 email: "john@example.com"
6 - name: "Jane Smith"
7 email: "jane@example.com"
description
string

将包含在包元数据中的 SDK 简要描述。此描述帮助用户在包存储库中发现您的 SDK 时了解您的 SDK 的功能。

authors

将在生成的 SDK 包元数据中被认可的作者列表。

name
stringRequired

在 SDK 包元数据中被认可的作者的全名。

email
stringRequired

作者的电子邮件地址。这将包含在包元数据中,包管理器可能会使用它作为联系信息。

readme

控制所有 SDK 中生成的 README 文件的内容,允许您自定义 SDK 文档的内容和结构。

generators.yml
1readme:
2 bannerLink: "https://example.com/banner"
3 introduction: "Welcome to our API"
4 apiReferenceLink: "https://docs.example.com"
5 apiName: "Example Product"
6 exampleStyle: "minimal"
7 disabledSections:
8 - "contributing"
9 defaultEndpoint:
10 method: "POST"
11 path: "/users"
12 stream: false
13 customSections:
14 - title: "Custom Section"
15 language: "java"
16 content: |
17 This is a custom section. Latest package info is {{ group }}:{{ artifact }}:{{ version }}.
18 - title: "Custom Section"
19 language: "typescript"
20 content: |
21 Custom section for {{ packageName }}
22 - title: "Another Custom Section"
23 language: "typescript"
24 content: |
25 A second custom section for {{ packageName }}
26 features:
27 authentication:
28 - method: "POST"
29 path: "/auth/login"
30 - "GET /auth/profile"
31 users:
32 - method: "GET"
33 path: "/users"
34 - method: "POST"
35 path: "/users"
string

URL for a banner image or link that appears at the top of the README.

introduction
string

Custom introduction text that appears at the beginning of the README.

string

URL to your external API documentation or reference guide.

apiName
string

Name of the API that appears in the README. Will appear as Your Api Name SDK or Your Api Name API throughout the README. Defaults to organization name if not set.

exampleStyle
'minimal' | 'comprehensive'Defaults to comprehensive

Controls whether usage examples show only required parameters (minimal) or all parameters (comprehensive). Currently only supported for Java SDKs. File an issue to request additional languages.

disabledSections
list of strings

Sections to disable in the README. Supported values: "contributing".

features
list of objects

Organizes endpoints into named feature sections within the README. Each feature creates a dedicated section with example code snippets for the specified endpoints.

Specifies which endpoint’s code snippet to showcase as the primary example in the README.

defaultEndpoint.method
stringRequired

HTTP method of the default endpoint (e.g., GET, POST, PUT, DELETE).

defaultEndpoint.path
stringRequired

Endpoint path for the default example (e.g., /users, /auth/login).

defaultEndpoint.stream
booleanDefaults to false

Whether the endpoint is a streaming endpoint. Defaults to false.

Define a custom section in the generated README for a specific SDK.

customSections.title
stringRequired

The title of the custom section as it will appear in the README.

customSections.language
'java' | 'typescript'Required

The target SDK language for this section. The custom section will only appear in README files generated for the specified language.

customSections.content
stringRequired

The Markdown content of the custom section. You can use template variables in the format {{ variable }} that will be dynamically replaced with values specific to each SDK language when the README is generated.

Available template variables by language:

LanguageVariableDescription
TypeScriptpackageNameName of your package, as specified in the package-name field
PythonpackageNameName of your package, as specified in the package_name field
GoownerThe owner of your Go module
GorepoThe repository where your Go module is published
GoversionSDK version
JavagroupMaven groupId from coordinate field
JavaartifactMaven artifactId from coordinate field
JavaversionSDK version
C#/.NETpackageNameName of your package, as specified in the package-id field
PHPpackageNameName of your package, as specified in the package-name field
RubypackageNameName of your package, as specified in the package-name field
SwiftgitUrlThe URL where your Swift package is published. For example, https://github.com/fern-api/basic-swift-sdk
SwiftminVersionSDK version

default-group

未指定时使用的生成器组。

1default-group: "production"
default-group
string

autorelease

全局启用或禁用 Fern Autorelease 以进行自动化 SDK 发布。或者,您可以为单个 SDK 配置自动发布

generators.yml
1autorelease: true
autorelease
boolean

设置为 true 启用自动发布,false 禁用它。每个生成器的设置覆盖此全局配置。

aliases

定义映射到多个生成器组的快捷方式,允许您使用单个命令运行多个组。当您运行 fern generate --group <alias> 时,别名中的所有组并行运行。您也可以将别名设置为 default-group

generators.yml
1aliases:
2 all: ["php-sdk", "ts-sdk", "go-sdk"]
3 frontend: ["ts-sdk"]
4 backend: ["php-sdk", "go-sdk"]
5
6groups:
7 php-sdk:
8 generators:
9 - name: fernapi/fern-php-sdk
10 version: 1.0.0
11 ts-sdk:
12 generators:
13 - name: fernapi/fern-typescript-sdk
14 version: 1.0.0
15 go-sdk:
16 generators:
17 - name: fernapi/fern-go-sdk
18 version: 1.0.0
aliases
map<string, list<string>>

一个映射,其中每个键是别名名称,值是组名称列表。每个组名称必须引用在 groups 部分中定义的组。

groups

组织用户定义的生成器集合,通常按环境(如”production”、“staging”)或语言(如”typescript”、“python”)分组。您还可以创建别名以使用单个命令运行多个组。

generators.yml
1groups:
2 typescript-sdk: # 用户定义的名称
3 audiences: ["external"]
4 generators:
5 - name: fernapi/fern-typescript-sdk
6 version: 0.9.0
7 output:
8 location: npm
9 package-name: "@myorg/api-sdk"
10 token: "${NPM_TOKEN}"
11 github:
12 repository: your-organization/company-typescript
13 mode: "pull-request"
14 metadata:
15 description: "MyAPI 的 TypeScript SDK"
16 authors:
17 - name: "SDK 团队"
18 email: "sdk@myorg.com"
19 reviewers:
20 teams:
21 - name: "sdk-team"
audiences
list of strings

基于受众标签过滤生成的 SDK 中包含的 API 元素。只有在您的 API 规范中标记为指定受众的端点、模式和属性才会被包含。没有此过滤器,无论端点的受众标签如何,都会包含所有端点。

要使用受众,首先使用 OpenAPI 中的 x-fern-audiencesFern 定义中的 audiences 标记您的 API 元素,然后在这里指定要包含的受众。

对于 OpenAPI,您还可以使用 settings.filter 在规范级别配置基于路径的过滤。

reviewers

为单个 SDK 设置代码审查者。或者,您可以为所有 SDK 全局配置审查者

generators.yml
1reviewers:
2 teams:
3 - name: "sdk-team"
4 - name: "api-team"
5 users:
6 - name: "john-doe"
7 - name: "jane-smith"
teams
list of strings

GitHub team names that should review generated code.

users
list of strings

GitHub users that should review generated code.

teams.name
stringRequired

Name of a GitHub team.

users.name
stringRequired

Name of a GitHub user.

generators

特定组的生成器设置。

generators.yml
1groups:
2 typescript-sdk:
3 audiences: ["external"]
4 generators:
5 - name: fernapi/fern-typescript-sdk
6 version: 3.69.0
7 smart-casing: true
8 python-sdk: # 具有自定义注册表的自托管
9 generators:
10 - image:
11 name: fern-python-sdk
12 registry: ghcr.io/your-org
13 version: 5.9.1
name
stringRequired

Fern 生成器包名称(例如,fernapi/fern-typescript-sdk)。与 image 互斥。

version
stringRequired

要使用的生成器的特定版本

smart-casing
booleanDefaults to false

启用智能大小写转换,保留数字和常见编程模式:

  • 数字保持不变(例如,v2 而不是 v_2getUsersV2 而不是 getUsersV_2
  • 首字母缩略词得到保留(例如,CustomerID 而不是 CustomerId
  • 首字母缩写词保持正确(例如,HTTPSConnection 保持 HTTPSConnection
image
object

自托管生成期间,使用 image 而不是 name自定义容器注册表拉取生成器(远程生成不支持自定义注册表)。与 name 互斥。

CLI 在拉取时构造完整的镜像引用为 {registry}/{name}:{version}。例如,使用 registry: ghcr.io/your-orgname: fern-python-sdkversion: 4.0.0,CLI 拉取 ghcr.io/your-org/fern-python-sdk:4.0.0

image.name
stringRequired

一个已识别的 Fern 生成器名称(例如,fern-python-sdk)。IR 版本解析需要此项。

image.registry
stringRequired

容器注册表主机名和可选命名空间(例如,ghcr.io/your-org)。CLI 在拉取时构造完整的镜像引用为 {registry}/{name}:{version}。例如,使用 registry: ghcr.io/your-orgname: fern-python-sdkversion: 4.0.0,CLI 拉取 ghcr.io/your-org/fern-python-sdk:4.0.0

config

特定语言的配置选项。

generators.yml
1groups:
2 ts-sdk: # Typescript SDK 组
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 version: 3.69.0
6 config: # TypeScript 特定的配置选项
7 namespaceExport: AcmePayments
8 noSerdeLayer: false

output

发布生成的 SDK 的位置。

generators.yml
1groups:
2 typescript-sdk: # 用户定义的名称
3 audiences: ["external"]
4 generators:
5 - name: fernapi/fern-typescript-sdk
6 version: 0.9.0
7 output:
8 location: npm
9 package-name: "@myorg/api-sdk"
10 token: "${NPM_TOKEN}"

将 TypeScript SDK 发布到 npm 注册表。

generators.yml
1output:
2 location: npm
3 package-name: "@myorg/api-sdk"
4 token: "${NPM_TOKEN}"
location
'npm'Required

设置为”npm”以发布到 NPM

url
stringDefaults to npmjs.com

自定义 NPM 注册表 URL

package-name
stringRequired

NPM 包名称(例如,“@myorg/api-sdk”)

token
string

用于发布的 NPM 身份验证令牌

将 Java SDK 发布到 Maven 存储库。

generators.yml
1output:
2 location: maven
3 coordinate: "com.myorg:api-sdk"
4 username: "${MAVEN_USERNAME}"
5 password: "${MAVEN_PASSWORD}"
6 signature:
7 keyId: "ABC123"
8 password: "${GPG_PASSWORD}"
9 secretKey: "${GPG_SECRET_KEY}"
location
'maven'Required

设置为”maven”以发布到 Maven

url
stringDefaults to npmjs.com

Maven 存储库 URL(可选,默认为 Maven Central)

coordinate
stringRequired

“groupId:artifactId”格式的 Maven 工件坐标

username
string

存储库身份验证用户名

password
string

存储库身份验证密码

signature
object

包签名的 GPG 签名配置

signature.keyId
stringRequired

用于包签名的 GPG 密钥 ID

signature.password
stringRequired

GPG 密钥密码

signature.secretKey
stringRequired

GPG 密钥内容

将 Python SDK 发布到 Python Package Index。

generators.yml
1output:
2 location: pypi
3 package-name: "myorg-api-sdk"
4 token: "${PYPI_TOKEN}"
5 metadata:
6 keywords: ["api", "sdk", "client"]
7 documentation-link: "https://docs.myorg.com"
8 homepage-link: "https://myorg.com"
location
'pypi'Required

设置为”pypi”以发布到 PyPI

url
string

自定义 PyPI 注册表 URL(可选,默认为 PyPI)

package-name
stringRequired

Python 包名称(例如,“myorg-api-sdk”)

token
string

用于发布的 PyPI 身份验证令牌

username
string

PyPI 用户名(令牌身份验证的替代方案)

password
string

PyPI 密码(令牌身份验证的替代方案)

metadata
objecta

包的额外 PyPI 特定元数据

metadata.keywords
list of string

用于 PyPI 搜索和发现的包关键字

metadata.documentation-link
string

包文档链接

metadata.homepage-link
string

项目主页链接

将 .NET SDK 发布到 NuGet 存储库。

generators.yml
1output:
2 location: nuget
3 package-name: "MyOrg.ApiSdk"
4 api-key: "${NUGET_API_KEY}"
location
'nuget'Required

设置为”nuget”以发布到 NuGet

url
string

自定义 NuGet feed URL(可选,默认为 nuget.org)

package-name
stringRequired

NuGet 包名称(例如,“MyOrg.ApiSdk”)

api-key
string

用于发布到 feed 的 NuGet API 密钥

将 Ruby SDK 发布到 RubyGems 注册表。

generators.yml
1output:
2 location: rubygems
3 package-name: "myorg_api_sdk"
4 api-key: "${RUBYGEMS_API_KEY}"
location
'rubygems'Required

设置为”rubygems”以发布到 RubyGems

url
string

自定义 RubyGems 注册表 URL(可选,默认为 rubygems.org)

package-name
stringRequired

Ruby gem 包名称(例如,“myorg_api_sdk”)

api-key
string

用于发布的 RubyGems API 密钥(需要”Push rubygem”权限)

注意: RubyGems API 密钥需要”Push rubygem”权限,理想情况下还需要”index”和”yank rubygem”权限。如果启用了 MFA,请确保 MFA 设置不要求为 API 密钥使用提供 MFA。

将 API 集合发布到 Postman 工作区。

generators.yml
1output:
2 location: postman
3 api-key: "${POSTMAN_API_KEY}"
4 workspace-id: "12345678-1234-1234-1234-123456789abc"
5 collection-id: "87654321-4321-4321-4321-cba987654321"
location
'postman'Required

设置为”postman”以发布到 Postman

api-key
stringRequired

用于工作区访问的 Postman API 密钥

workspace-id
stringRequired

将发布集合的目标 Postman 工作区 ID

collection-id
string

要更新的现有集合 ID(如果未指定则创建新集合)

将生成的 SDK 保存到本地文件系统而不是发布。

generators.yml
1output:
2 location: local-file-system
3 path: "./generated-sdks/typescript"
location
'local-file-system'Required

设置为”local-file-system”以本地输出

path
stringRequired

生成的文件将保存的本地目录路径

github

使用 github 配置指定如何在 GitHub 中生成 SDK。 指定 mode 以指定 Fern 如何处理您的代码更改。对于云生成,使用 repository 指定 GitHub 存储库。对于自托管生成,改用 uritoken

确保在您的目标存储库上安装了 Fern GitHub 应用(自托管生成不需要)

Fern 生成您的代码,提交到 main 分支,并标记新版本。

1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 github:
7 repository: "your-org/your-repo-name"
8 mode: "release"
repository
stringRequired

您在 GitHub 中的存储库名称。

mode
'release'
branch
string

您在 GitHub 中的分支名称。

license
'MIT' | 'Apache-2.0' | 'Custom License Name'

生成的 SDK 的软件许可证。

reviewers
{ teams: list<string>, users: list<string> }

指定哪些团队和用户应审查生成的代码。请参阅审查者配置

Fern 生成您的代码,提交到新分支,并打开 PR 进行审查。要发布,您必须合并 PR 并标记 GitHub 版本。

1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 github:
7 repository: "your-org/your-repo-name"
8 mode: "pull-request"
repository
stringRequired

您在 GitHub 中的存储库名称。

mode
'pull-request'
branch
string

您在 GitHub 中的分支名称。

license
'MIT' | 'Apache-2.0' | 'Custom License Name'

生成的 SDK 的软件许可证。

reviewers
list of objects

指定哪些团队和用户应审查生成的代码。请参阅审查者配置

Fern 生成您的代码并将其推送到您指定的分支。

1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 github:
7 repository: "your-org/your-repo-name"
8 mode: "push"
9 branch: "your-branch-name" # `mode: push` 必需
repository
stringRequired

您在 GitHub 中的存储库名称。

mode
'push'
branch
stringRequired

您在 GitHub 中的分支名称。

license
'MIT' | 'Apache-2.0' | 'Custom License Name'

生成的 SDK 的软件许可证。

reviewers
{ teams: list<string>, users: list<string> }

指定哪些团队和用户应审查生成的代码。请参阅审查者配置

对于自托管 SDK 生成,使用 uritoken 而不是 repository 配置 github 属性。

1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 github:
7 uri: "https://github.com/your-org/your-repo-name"
8 token: "${GITHUB_TOKEN}"
9 mode: "push"
10 branch: "main"
uri
stringRequired

您的 GitHub 存储库的完整 URL(例如,https://github.com/your-org/your-repo)。

token
stringRequired

具有存储库写入权限的 GitHub 个人访问令牌。使用环境变量引用(例如,${GITHUB_TOKEN})。

mode
'push' | 'pull-request'

如何发布更改:push 直接提交到分支,pull-request 打开 PR 进行审查。

branch
string

提交或拉取请求的目标分支。

metadata

指定单个 SDK 的元数据。或者,您可以为所有 SDK 全局配置元数据

generators.yml
1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 metadata:
7 package-description: "您的 SDK 描述"
8 email: "sdk@example.com"
9 reference-url: "https://docs.example.com/sdks"
10 license: "MIT"
package-description
string

您生成的 SDK 功能及其关键特性的简要描述。这出现在 package.json 描述字段和包注册表列表中。

email
string

包维护者或支持团队的联系电子邮件。

reference-url
string

指向 SDK 的综合文档、API 参考或入门指南的 URL。

author
string

创建和维护 SDK 的个人开发者、团队或组织的名称。

license
'MIT' | 'Apache-2.0' | 'Custom License Name'

生成的 SDK 的软件许可证。

autorelease

为单个 SDK 启用或禁用 Fern Autorelease。或者,您可以为所有 SDK 全局配置自动发布

generators.yml
1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 autorelease: true
autorelease
boolean

设置为 true 为此生成器启用自动发布,false 禁用它。每个生成器的设置覆盖全局 autorelease 配置。

snippets

为特定生成器配置代码片段。

generators.yml
1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 snippets:
7 path: "./snippets"
path
stringRequired

生成的代码片段文件的路径。

覆盖 API 身份验证设置

使用 api 配置为特定 SDK 覆盖身份验证设置。

按名称引用预定义的身份验证方案

generators.yml
1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 api:
7 auth: "bearer-token"
auth
string | { scheme: string }

要使用的身份验证方案。可以是字符串引用("bearer-token")或方案对象(scheme: "bearer-token")。

允许用户使用多种方法中的任何一种进行身份验证:

generators.yml
1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 api:
7 auth:
8 any:
9 - "api-key"
10 - "bearer-token"
11 - scheme: "oauth-flow"
any
list<string | { scheme: string }>Required

用户可以选择任何一种方法的身份验证方案列表。每个项可以是字符串引用("api-key")或方案对象(scheme: "api-key")。

使用 auth-schemes 定义自定义身份验证方案。您为自定义方案定义名称,然后指定身份验证方法(headerbasicbeareroauth)。

generators.yml
1groups:
2 ts-sdk:
3 generators:
4 - name: fernapi/fern-typescript-sdk
5 ...
6 api:
7 auth-schemes:
8 bearer: # 您的身份验证模式的用户定义名称
9 scheme: "bearer"
10 token:
11 name: "token"
12 env: "BEARER_TOKEN"

Configure authentication using custom HTTP headers, such as API keys or tokens.

1auth-schemes:
2 api-key: # User-defined scheme name
3 name: "API Key Authentication"
4 header: "X-API-Key"
5 type: "string"
6 prefix: "ApiKey "
7 env: "MY_API_KEY" # SDK will auto-scan this environment variable
header
stringRequired

The name of the HTTP header to use for authentication.

name
string

A descriptive name for this authentication scheme.

type
stringDefaults to string

The type of the header value.

prefix
string

A prefix to prepend to the header value (e.g., "Bearer " or "Token ").

env
string

Environment variable name containing the authentication value. When specified, the generated SDK will automatically scan for this environment variable at initialization.

Configure HTTP Basic authentication using username and password credentials.

1auth-schemes:
2 basic-auth: # User-defined scheme name
3 scheme: basic
4 username:
5 name: "Username"
6 env: "BASIC_AUTH_USERNAME" # SDK will auto-scan this environment variable
7 password:
8 name: "Password"
9 env: "BASIC_AUTH_PASSWORD" # SDK will auto-scan this environment variable
scheme
'basic'Required

Must be set to "basic" for Basic authentication schemes.

username
object

Configuration for the username credential.

username.name
string

Custom parameter name for the username in the generated SDK. If not specified, defaults to "username". Use this to provide more descriptive or domain-specific parameter names like "clientId", "userEmail", or "merchantId".

password
object

Configuration for the password credential.

password.name
string

Custom parameter name for the password in the generated SDK. If not specified, defaults to "password". Use this to provide more descriptive or domain-specific parameter names like "clientSecret", "apiKey", or "merchantKey".

username.env, password.env
string

Environment variable name that the SDK will automatically scan for the username or password value. When this environment variable is present, users don’t need to explicitly provide the username parameter. Follow naming conventions like YOUR_APP_USERNAME or SERVICE_CLIENT_ID.

Configure Bearer token authentication for API access.

1auth-schemes:
2 bearer-token: # User-defined scheme name
3 scheme: bearer
4 token:
5 name: "Access Token"
6 env: "BEARER_TOKEN" # SDK will auto-scan this environment variable
scheme
'bearer'Required

Must be set to "bearer" for Bearer token authentication schemes.

token
object

Configuration for the bearer token.

token.name
string

A descriptive name for the token.

token.env
string

Environment variable name containing the bearer token. When specified, the generated SDK will automatically scan for this environment variable at initialization.

For Fern Definition, you can configure OAuth authentication either in generators.yml or directly in your api.yml file. For OpenAPI, OAuth must be configured in generators.yml.

Configure OAuth 2.0 client credentials authentication. Optionally configure a refresh-token endpoint for token renewal without re-authentication.

generators.yml
1auth-schemes:
2 my-oauth: # User-defined scheme name
3 scheme: oauth
4 type: client-credentials
5 scopes:
6 - "read:users"
7 - "write:users"
8 client-id-env: "OAUTH_CLIENT_ID" # SDK will auto-scan this environment variable
9 client-secret-env: "OAUTH_CLIENT_SECRET" # SDK will auto-scan this environment variable
10 token-prefix: "Bearer"
11 token-header: "Authorization"
12 get-token:
13 endpoint: "auth.get_token"
14 request-properties:
15 client-id: "clientId"
16 client-secret: "clientSecret"
17 scopes: "scope"
18 response-properties:
19 access-token: "access_token"
20 expires-in: "expires_in"
21 refresh-token: "refresh_token"
22 refresh-token:
23 endpoint: "auth.refresh_token"
24 request-properties:
25 refresh-token: "refreshToken"
26 response-properties:
27 access-token: "access_token"
28 expires-in: "expires_in"
29 refresh-token: "refresh_token"
scheme
'oauth'Required

Must be set to "oauth" for OAuth authentication schemes.

type
'client-credentials'Required

The OAuth 2.0 grant type. Currently only "client-credentials" is supported.

scopes
list of strings

OAuth scopes to request when obtaining access tokens (e.g., "read:users", "write:orders").

client-id-env
string

Environment variable name containing the OAuth client ID. When specified, the generated SDK will automatically scan for this environment variable at initialization.

client-secret-env
string

Environment variable name containing the OAuth client secret. When specified, the generated SDK will automatically scan for this environment variable at initialization.

token-prefix
stringDefaults to Bearer

Prefix added to the access token in the Authorization header (e.g., "Bearer" results in "Authorization: Bearer <token>"). Useful when your API expects a custom format.

token-header
stringDefaults to Authorization

HTTP header name used to send the access token. Defaults to "Authorization" but can be customized if your API uses a different header (e.g., "X-API-Token").

get-token

Specifies the endpoint that exchanges client credentials for an access token. This endpoint is called automatically when the SDK client is initialized.

generators.yml
1get-token:
2 endpoint: "auth.get_token"
3 request-properties:
4 client-id: "clientId"
5 client-secret: "clientSecret"
6 response-properties:
7 access-token: "access_token"
8 expires-in: "expires_in"
endpoint
stringRequired

The endpoint that issues access tokens, such as 'auth.get_token' or 'POST /oauth/token'. If your API uses namespaces, prefix with the namespace and :: (e.g., 'payments::POST /oauth/token').

request-properties
object

Maps OAuth parameter names to your API’s request field names. Use this when your token endpoint expects different field names than the OAuth standard (e.g., your API uses clientId instead of client_id).

request-properties.client-id
string

The request field name for the client ID in your API (e.g., "clientId", "client_id").

request-properties.client-secret
string

The request field name for the client secret in your API (e.g., "clientSecret", "client_secret").

request-properties.scopes
string

The request field name for scopes in your API (e.g., "scope", "scopes").

response-properties
object

Maps your API’s response field names to OAuth standard names. Use this when your API returns tokens with different field names (e.g., accessToken instead of access_token).

response-properties.access-token
string

The response field name for the access token in your API (e.g., "accessToken", "access_token").

response-properties.expires-in
string

The response field name for token expiration time in seconds (e.g., "expiresIn", "expires_in"). When present, the SDK automatically refreshes tokens before expiration.

refresh-token
string

The response field name for the refresh token in your API (e.g., "refreshToken", "refresh_token"). Required if using the refresh-token flow.

refresh-token

Specifies the endpoint that exchanges a refresh token for a new access token. When configured, the SDK automatically uses this endpoint to renew expired tokens without re-sending credentials. If not configured, the SDK will re-authenticate using get-token when tokens expire.

generators.yml
1refresh-token:
2 endpoint: "auth.refresh_token"
3 request-properties:
4 refresh-token: "refreshToken"
5 response-properties:
6 access-token: "access_token"
7 expires-in: "expires_in"
endpoint
stringRequired

The endpoint that refreshes access tokens (e.g., "POST /oauth/refresh" or "auth.refreshToken"). If your API uses namespaces, prefix with the namespace and :: (e.g., "payments::POST /oauth/refresh").

request-properties
object

Maps OAuth parameter names to your API’s request field names for the refresh flow.

request-properties.refresh-token
stringRequired

The request field name for the refresh token in your API (e.g., "refreshToken", "refresh_token").

response-properties
object

Maps your API’s refresh response field names to OAuth standard names.

response-properties.access-token
string

The response field name for the new access token (e.g., "accessToken", "access_token").

response-properties.expires-in
string

The response field name for the new token’s expiration time in seconds (e.g., "expiresIn", "expires_in").

response-properties.refresh-token
string

The response field name if your API issues a new refresh token with each refresh (token rotation).

reviewers

为所有 SDK 全局设置代码审查者。或者,您可以为单个 SDK 配置审查者

generators.yml
1reviewers:
2 teams:
3 - name: "sdk-team"
4 - name: "api-team"
5 users:
6 - name: "john-doe"
7 - name: "jane-smith"
teams
list of strings

GitHub team names that should review generated code.

users
list of strings

GitHub users that should review generated code.

teams.name
stringRequired

Name of a GitHub team.

users.name
stringRequired

Name of a GitHub user.