Swift configuration

View as Markdown

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

generators.yml
1groups:
2 swift-sdk:
3 generators:
4 - name: fernapi/fern-swift-sdk
5 version: 0.25.3
6 config:
7 clientClassName: YourClientName
8 environmentEnumName: YourCustomEnvironment
9 moduleName: MyCustomModule
10 enableWireTests: false
11 nullableAsOptional: true
clientClassName
string

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

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) and ensures consistent naming across SDK generations.

moduleName
string

The module name used in client code (e.g., import MyCustomModule). When provided, this name is used consistently across the library, product, and target.

enableWireTests
booleanDefaults to true

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

nullableAsOptional
booleanDefaults to false

When enabled, nullable fields are decoded as Swift optionals (T?) instead of the Nullable<T> wrapper type. This simplifies type handling but loses the ability to distinguish between explicit null values and absent fields. When disabled (default), nullable fields use the Nullable<T> wrapper type which preserves the distinction between fields explicitly set to null and fields that are missing from the response.