Rust configuration

View as Markdown

You can customize the behavior of the Rust SDK generator in generators.yml:

generators.yml
1groups:
2 rust-sdk:
3 generators:
4 - name: fernapi/fern-rust-sdk
5 version: 0.13.3
6 config:
7 clientClassName: YourClientName
8 crateName: your-crate-name
9 crateVersion: "1.0.0"
10 environmentEnumName: YourEnvironment
11 enableWireTests: true
clientClassName
string

The name of the generated client struct. This allows you to customize the struct name that users will instantiate when using your SDK.

crateName
string

The name of the generated Rust crate. This is used in Cargo.toml and determines how users will add your SDK as a dependency.

crateVersion
string

The version of the generated crate. This is used in Cargo.toml for publishing to crates.io.

environmentEnumName
string

The name of the generated environment enum. This allows you to customize the enum name that defines your API environments (such as production, staging, development).

enableWireTests
booleanDefaults to false

When enabled, generates mock server (wire) tests to verify that the SDK sends the correct HTTP requests and correctly handles responses per the API spec.

generateExamples
booleanDefaults to true

When enabled, generates code examples in the README and reference documentation.

Package metadata

Configure metadata for publishing to crates.io:

generators.yml
1config:
2 packageDescription: "SDK for the Plant Store API"
3 packageLicense: "MIT"
4 packageRepository: "https://github.com/your-org/your-sdk"
5 packageDocumentation: "https://docs.example.com"
packageDescription
string

A description of the crate for crates.io. This appears in the crate’s metadata and search results.

packageLicense
string

The license identifier for the crate (e.g., “MIT”, “Apache-2.0”).

packageRepository
string

The URL of the crate’s source repository.

packageDocumentation
string

The URL of the crate’s documentation.

Dependencies

Add custom dependencies to your generated SDK:

generators.yml
1config:
2 extraDependencies:
3 tokio: "1.0"
4 serde_json: "1.0"
5 extraDevDependencies:
6 mockall: "0.11"
extraDependencies
object

Additional dependencies to include in the generated Cargo.toml. Specify as a map of crate names to version requirements.

extraDevDependencies
object

Additional dev dependencies to include in the generated Cargo.toml. These are only used during development and testing.