生成 SDK
生成 SDK
按照此页面上的说明生成 TypeScript SDK。
已经完成了 快速开始?跳转到 设置 GitHub 仓库。
Initialize the fern folder
Initialize the fern folder with your existing OpenAPI specification, or start from scratch with a Fern Definition template. Specify your organization name using the --organization flag.
OpenAPI accepts both JSON and YAML formats. You can always convert a Fern Definition to OpenAPI or OpenAPI to a Fern Definition later on.
This creates a fern folder in your current directory.
OpenAPI
Fern Definition
Validate your API definition
Check that your API definition is valid, and fix errors before proceeding:
生成 SDK
fern init 默认包含 TypeScript SDK 生成器,因此您可以立即生成:
This creates a sdks folder in your current directory. The resulting folder structure looks like this:
Set up GitHub repositories
Fern uses a multi-repo structure: your source repository contains the fern/ folder, and each SDK gets its own separate repository.
- Create a source repository for your
fern/folder if you don’t have one already (e.g.,your-org/your-api-definitions). - Create an SDK repository for your SDK (e.g.,
your-org/your-api-typescript-sdk). - Install the Fern GitHub App on both repositories.