generators.yml Configuration Schema
The generators.yml
file configures how Fern generates SDKs from your API
specification, including which languages to generate, where to publish them, and
how to customize each SDK. This document describes the complete configuration
schema for generators.yml
.
auth-schemes
Define authentication methods for your API. Create named authentication schemes that your endpoints can reference.
Choose from custom headers (API keys), HTTP Basic, Bearer token, or OAuth 2.0 authentication.
Header Authentication
Configure authentication using custom HTTP headers, such as API keys or tokens.
The name of the HTTP header to use for authentication.
A descriptive name for this authentication scheme.
The type of the header value.
A prefix to prepend to the header value (e.g., "Bearer "
or "Token "
).
Environment variable name containing the authentication value. When specified, the generated SDK will automatically scan for this environment variable at initialization.
Basic Authentication
Configure HTTP Basic authentication using username and password credentials.
Must be set to "basic"
for Basic authentication schemes.
Configuration for the username credential.
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"
.
Configuration for the password credential.
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"
.
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
.
Bearer Token Authentication
Configure Bearer token authentication for API access.
Must be set to "bearer"
for Bearer token authentication schemes.
Configuration for the bearer token.
A descriptive name for the token.
Environment variable name containing the bearer token. When specified, the generated SDK will automatically scan for this environment variable at initialization.
OAuth Authentication
Configure OAuth 2.0 client credentials authentication.
Must be set to "oauth"
for OAuth authentication schemes.
The OAuth flow type. Currently only "client-credentials"
is supported.
List of OAuth scopes to request during authentication.
Environment variable name containing the OAuth client ID. When specified, the generated SDK will automatically scan for this environment variable at initialization.
Environment variable name containing the OAuth client secret. When specified, the generated SDK will automatically scan for this environment variable at initialization.
Sets the token header value prefix.
Sets the token header key name.
get-token
Configuration for the token acquisition endpoint.
The endpoint to get the access token, such as 'auth.get_token'
.
Customizes the property names used in the token request.
The property name for the client ID in the request.
The property name for the client secret in the request.
The property name for the scopes in the request.
Maps custom property names in your OAuth token response (e.g., if your API returns accessToken
instead of access_token
).
The property name for the access token in the response.
The property name for the expires in property in the response.
The property name for the refresh token in the response.
refresh-token
Configuration for the token refresh endpoint.
The endpoint to refresh the access token, such as 'auth.refresh_token'
.
Maps custom property names in your refresh token request.
The property name for the refresh token in the request.
Maps custom property names in your refresh token response.
The property name for the access token in the response.
The property name for the expires in property in the response.
The property name for the refresh token in the response.
api
Defines the API specification (OpenAPI, AsyncAPI, etc.) and how to parse it.
specs
List of API specifications or Conjure configuration.
auth
Authentication configuration for the API.
headers
Global headers to include with all API requests. You can specify headers as simple string values or as objects with additional configuration for code generation.
Simple string values:
Advanced configuration with type information:
environments
Environment configurations for different deployment targets.
Specification Types
OpenAPI
openapi
Path to the OpenAPI specification file.
origin
URL of the API definition origin for polling updates.
overrides
Path to OpenAPI overrides file.
namespace
Namespace for the specification.
settings
OpenAPI-specific generation settings.
title-as-schema-name
Whether to use the titles of schemas within an OpenAPI definition as the names of types within Fern.
inline-path-parameters
Whether to include path parameters within the generated in-lined request.
prefer-undiscriminated-unions-with-literals
Whether to prefer undiscriminated unions with literals.
only-include-referenced-schemas
Whether to only include schemas referenced by endpoints in the generated SDK (tree-shaking).
respect-nullable-schemas
Preserves nullable schemas in API definition settings. When false, nullable schemas are treated as optional.
object-query-parameters
Enables parsing deep object query parameters.
respect-readonly-schemas
Enables exploring readonly schemas in OpenAPI specifications.
respect-forward-compatible-enums
Enables respecting forward compatible enums in OpenAPI specifications.
use-bytes-for-binary-response
Enables using the bytes
type for binary responses. Defaults to file stream.
default-form-parameter-encoding
The default encoding of form parameters. Options: form
, json
.
additional-properties-defaults-to
Configure what additionalProperties
should default to when not explicitly defined on a schema.
type-dates-as-strings
If true, convert strings with format date to strings. If false, convert to dates.
preserve-single-schema-oneof
If true, preserve oneOf structures with a single schema. If false, unwrap them.
filter.endpoints
Endpoints to include in the generated SDK (e.g., “POST /users”).
example-generation.request.max-depth
Controls the maximum depth for which optional properties will have examples generated. A depth of 0 means no optional properties will have examples.
example-generation.response.max-depth
Controls the maximum depth for which optional properties will have examples generated in responses.
AsyncAPI
asyncapi
Path to the AsyncAPI specification file.
origin
URL of the API definition origin for polling updates.
overrides
Path to AsyncAPI overrides file.
namespace
Namespace for the specification.
settings
AsyncAPI-specific generation settings.
message-naming
What version of message naming to use for AsyncAPI messages. Options: v1
, v2
.
title-as-schema-name
Whether to use the titles of schemas within an AsyncAPI definition as the names of types within Fern.
respect-nullable-schemas
Preserves nullable schemas in API definition settings. When false, nullable schemas are treated as optional.
Protocol Buffers
proto
Protocol Buffers configuration.
target
Path to the target .proto
file (e.g., proto/user/v1/user.proto
).
root
Path to the .proto
directory root (e.g., proto
).
overrides
Path to the overrides configuration.
local-generation
Whether to compile .proto
files locally. Defaults to remote generation.
OpenRPC
.openrpc
Path to the OpenRPC specification file.
overrides
Path to OpenRPC overrides file.
namespace
Namespace for the specification.
Conjure
conjure
Path to Conjure specification file.
whitelabel
Configuration for publishing generated SDKs without Fern branding. When enabled, removes all mentions of Fern from the generated code and allows publishing under your own brand.
username
The GitHub username that will be used for committing and publishing the whitelabeled SDK code to GitHub repositories. This should be the username of the account that has write access to your target repositories.
The email address associated with the GitHub account. This email will be used in Git commits when publishing the whitelabeled SDK code and should match the email configured in your GitHub account settings.
token
A GitHub Personal Access Token (PAT) with appropriate permissions for repository access. The token should have repo
scope permissions to allow reading from and writing to your repositories for publishing whitelabeled SDKs.
metadata
Package metadata like description and authors that gets included in generated SDKs.
description
A brief description of the SDK that will be included in package metadata. This description helps users understand what your SDK does when they discover it in package repositories.
authors
A list of authors who will be credited in the generated SDK’s package metadata.
name
The full name of the author to be credited in the SDK package metadata.
The email address of the author. This will be included in package metadata and may be used by package managers for contact information.
readme
Controls what goes into the generated README files across all SDKs, allowing you to customize the content and structure of your SDK documentation.
bannerLink
URL for a banner image or link that appears at the top of the README.
introduction
Custom introduction text that appears at the beginning of the README.
apiReferenceLink
URL to your external API documentation or reference guide.
defaultEndpoint
Specifies which endpoint’s code snippet to showcase as the primary example in the README.
features
Groups endpoints by feature name for organized README sections. Each feature becomes a section in the README with example code snippets for the listed endpoints.
defaultEndpoint
Specifies which endpoint’s code snippet to showcase as the primary example in the README.
method
HTTP method of the default endpoint (e.g., GET
, POST
, PUT
, DELETE
).
path
Endpoint path for the default example (e.g., /users
, /auth/login
).
stream
Whether the endpoint is a streaming endpoint. Defaults to false
.
default-group
Which group to use when none is specified.
default-group
groups
Organizes user-defined sets of generators, typically grouped by environment (like “production”, “staging”) or language (like “typescript”, “python”).
Target audiences for this generator group (e.g., “external”, “internal”)
reviewers
Who should review generated code for a specific group.
teams
GitHub team names that should review generated code.
users
GitHub users that should review generated code.
name
Name of a GitHub team or a user.
generators
Individual generator settings within a group.
The Fern generator package name (e.g., fernapi/fern-typescript-node-sdk)
Specific version of the generator to use
output
Configuration for where and how to publish the generated SDK
npm Output
Publish TypeScript/JavaScript SDKs to NPM registry.
Set to “npm” for NPM publishing
Custom NPM registry URL
NPM package name (e.g., “@myorg/api-sdk”)
NPM authentication token for publishing
Maven Output
Publish Java SDKs to Maven repository.
Set to “maven” for Maven publishing
Maven repository URL (optional, defaults to Maven Central)
Maven artifact coordinate in “groupId:artifactId” format
Repository authentication username
Repository authentication password
GPG signature configuration for package signing
GPG key ID for package signing
GPG key password
GPG secret key content
PyPI Output
Publish Python SDKs to Python Package Index.
Set to “pypi” for PyPI publishing
Custom PyPI registry URL (optional, defaults to PyPI)
Python package name (e.g., “myorg-api-sdk”)
PyPI authentication token for publishing
PyPI username (alternative to token authentication)
PyPI password (alternative to token authentication)
Additional PyPI-specific metadata for the package
Package keywords for PyPI search and discovery
Link to package documentation
Link to project homepage
NuGet Output
Publish .NET SDKs to NuGet repository.
Set to “nuget” for NuGet publishing
Custom NuGet feed URL (optional, defaults to nuget.org)
NuGet package name (e.g., “MyOrg.ApiSdk”)
NuGet API key for publishing to the feed
RubyGems Output
Publish Ruby SDKs to RubyGems registry.
Set to “rubygems” for RubyGems publishing
Custom RubyGems registry URL (optional, defaults to rubygems.org)
Ruby gem package name (e.g., “myorg_api_sdk”)
RubyGems API key for publishing (requires “Push rubygem” permission)
Note: RubyGems API keys need “Push rubygem” permission and ideally “index” and “yank rubygem” permissions. If MFA is enabled, ensure MFA settings don’t require MFA for API key usage.
Postman Output
Publish API collections to Postman workspace.
Set to “postman” for Postman publishing
Postman API key for workspace access
Target Postman workspace ID where collection will be published
Existing collection ID to update (creates new collection if not specified)
Local File System Output
Save generated SDKs to local file system instead of publishing.
Set to “local-file-system” for local output
Local directory path where generated files will be saved
github
Specify how your SDKs are generated in GitHub using the github
configuration.
Designate the mode
to specifiy how Fern handles your code changes. For all of the
modes, you must specify the GitHub repository in which you want to store your
SDK code. You can also configure a branch name, license, and reviewers.
Release (recommended)
Fern generates your code, commits it to main, and tags a new release.
repository
mode
branch
license
reviewers
Specify which teams and users should review generated code. See reviewers configuration.
Pull request
Fern generates your code, commits to a new branch, and opens a PR for review. To publish, you must merge the PR and tag a GitHub release.
repository
mode
branch
license
reviewers
Specify which teams and users should review generated code. See reviewers configuration.
Push
Fern generates your code and pushes it to the branch you specify.
repository
mode
branch
license
reviewers
Specify which teams and users should review generated code. See reviewers configuration.
metadata
Specify metadata for your SDK generator.
package-description
A brief description of what your generated SDK does and its key features. This appears in the package.json
description field and package registry listings.
Contact email for the package maintainer or support team.
reference-url
URL pointing to comprehensive documentation, API reference, or getting started guide for the SDK.
author
Name of the individual developer, team, or organization that created and maintains the SDK.
license
Software license for the generated SDK.
snippets
Configures snippets for a particular generator.
path
The path to the generated snippets file.
Override API Authentication Settings
Override authentication settings in your API spec using the api
configuration.
You can specify authentication schemes, reference existing auth configurations,
and set additional API-specific settings.
Single Authentication Scheme
Reference a pre-defined authentication scheme by name.
auth
The authentication scheme to use. Can be either a string reference ("bearer-token"
) or scheme object (scheme: "bearer-token"
).
Multiple Authentication Options
Allow users to authenticate with any of several methods:
any
A list of authentication schemes where users can choose any one method. Each item can be either a string reference ("api-key"
) or scheme object (scheme: "api-key"
).
Custom Authentication Schemes
Define a custom authentication schemes using auth-schemes
. You define a name for your custom scheme, and then specify the authentication method (header
, basic
, bearer
, or oauth
).
Header authentication
Configure authentication using custom HTTP headers, such as API keys or tokens.
The name of the HTTP header to use for authentication.
A descriptive name for this authentication scheme.
The type of the header value.
A prefix to prepend to the header value (e.g., "Bearer "
or "Token "
).
Environment variable name containing the authentication value. When specified, the generated SDK will automatically scan for this environment variable at initialization.
Basic authentication
Configure HTTP Basic authentication using username and password credentials.
Must be set to "basic"
for Basic authentication schemes.
Configuration for the username credential.
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"
.
Configuration for the password credential.
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"
.
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
.
Bearer Token Authentication
Configure Bearer token authentication for API access.
Must be set to "bearer"
for Bearer token authentication schemes.
Configuration for the bearer token.
A descriptive name for the token.
Environment variable name containing the bearer token. When specified, the generated SDK will automatically scan for this environment variable at initialization.
OAuth Client Credentials
Configure OAuth 2.0 client credentials authentication.
Must be set to "oauth"
for OAuth authentication schemes.
The OAuth flow type. Currently only "client-credentials"
is supported.
List of OAuth scopes to request during authentication.
Environment variable name containing the OAuth client ID. When specified, the generated SDK will automatically scan for this environment variable at initialization.
Environment variable name containing the OAuth client secret. When specified, the generated SDK will automatically scan for this environment variable at initialization.
Sets the token header value prefix.
Sets the token header key name.
get-token
Configuration for the token acquisition endpoint.
The endpoint to get the access token, such as 'auth.get_token'
.
Customizes the property names used in the token request.
The property name for the client ID in the request.
The property name for the client secret in the request.
The property name for the scopes in the request.
Maps custom property names in your OAuth token response (e.g., if your API returns accessToken
instead of access_token
).
The property name for the access token in the response.
The property name for the expires in property in the response.
The property name for the refresh token in the response.
refresh-token
Configuration for the token refresh endpoint.
The endpoint to refresh the access token, such as 'auth.refresh_token'
.
Maps custom property names in your refresh token request.
The property name for the refresh token in the request.
Maps custom property names in your refresh token response.
The property name for the access token in the response.
The property name for the expires in property in the response.
The property name for the refresh token in the response.
reviewers
Who should review generated code for all groups.
teams
GitHub team names that should review generated code.
users
GitHub users that should review generated code.
name
Name of a GitHub team or a user.